- Recursively Remove .DS_Store Files on Mac OS X
find . -name ‘*.DS_Store’ -type f -delete
- Generate random mac address and set it
sudo ifconfig en0 ether $(perl -e 'for ($i=0;$i<5;$i++){@m[$i]=int(rand(256));} printf "02:%X:%X:%X:%X:%X\n",@m;') && sudo ifconfig en0 down && sudo ifconfig en0 up
- Get list of huge files
mdfind 'kMDItemFSSize>=1e8&&kMDItemContentTypeTree!=public.directory' | while IFS= read -r l; do stat -f'%z %N' "$l"; done | sort -rn
- Sync folder with public read right (perfect for a website)
aws s3 sync . s3://my-bucket/path --acl public-read
- Get first 200Mb of a file in a S3 buck
aws s3api get-object --bucket bucket_name --key file_name_from_bucket.csv file_name_to_your_computer.csv --range bytes=0-200000000
- Add 1GB of swap
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
cat '/var/swap.1 swap swap defaults 0 0' >> /etc/fstab
alias tasks='grep --color --exclude-dir={.git,DerivedData,Pods} -rEI "TODO|FIXME" . 2>/dev/null'
alias hdump='hexdump -v -e '\''"%010_ad |" 16/1 "%_p" "|\n"'\'''
alias my_ip='wget http://ipinfo.io/ip -qO -'
- Removing duplicates (and sorting it) without touching to CSV header
awk 'NR<1;!seen[$0]++' file