VirtualTam's bookmarks

  1. 1git rev-list --objects --all \
    2| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
    3| sed -n 's/^blob //p' \
    4| sort --numeric-sort --key=2 --reverse \
    5| head -n 150 \
    6| cut -c 1-12,41- \
    7| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
    
  2. 1for i in $(find /usr/lib -type f -name '*.so.*'); do
    2      nm -D $i | grep MY_SYMBOL;
    3      [[ $? -eq 0 ]] && echo $i;
    4done
    

    adapted from http://narkive.com/a1rT9Efg.8

  3.  1#!/bin/bash
     2# Check if a file needs to be downloaded
     3# Useful iff there is no checksum available to check a local file
     4url=http://test-url.com
     5
     6dl=1
     7if [[ -f $file_path ]]; then
     8    local_size=$(ls -l $file_path | awk '{print $5}')
     9    remote_size=$(wget --spider $url 2>&1 | awk '/Length/ {print $2}')
    10
    11    if [[ $local_size -eq $remote_size ]]; then
    12        echo "The file was previously downloaded"
    13        dl=0
    14    else
    15        echo "Corrupted file found, re-downloading..."
    16        rm -f $file_path
    17    fi
    18else
    19    echo "Downloading file..."
    20fi
    21
    22[[ $dl -eq 1 ]] && wget $url -O $file_path