Skip to content

Instantly share code, notes, and snippets.

@ncimino
ncimino / key-fingerprint
Created July 26, 2016 13:09 — forked from yosemitebandit/key-fingerprint
view your ssh public key's fingerprint; compare this to what Github has listed in the ssh key audit
$ ssh-keygen -l -f /path/to/keys/id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
fconfigure $fd_bit -translation binary
@ncimino
ncimino / gist:0536da3dd0597b411131
Created August 10, 2014 00:21
Syncing parts of directories with rsync
# sync all files starting with 0-9 or a-n or A-N
rsync -vram -f'+ [0-9a-nA-N]*' -f'+ */' -f'- *' /src /dest1
# sync all files starting with m-z or M-Z
rsync -vram -f'+ [m-zM-Z]*' -f'+ */' -f'- *' /src /dest2
@ncimino
ncimino / gist:147a9e33e6beccf351f2
Created August 10, 2014 00:10
Quickly find total size (in bytes) of all files matching pattern
find /path/to/files -type f -print0 | xargs -0 ls -l | awk '{x+=$5} END {print "total bytes: " x}'
@ncimino
ncimino / gist:346b1d869c14b6b005f7
Last active August 29, 2015 14:05
Linux Disks
fdisk -l | grep '^Disk'; # list drives
file -s /dev/sdd; # list device sdd details
fsck /dev/sdd; # check device sdd
fdisk /dev/sdd; # partition drive
# m - print help
# p - print the partition table
# n - create a new partition
# d - delete a partition
# q - quit without saving changes
@ncimino
ncimino / gist:5526288
Created May 6, 2013 16:39
Multi character (string) split in Tcl
# mcsplit --
#
# Splits a string based using another string
#
# Arguments:
# str string to split into pieces
# splitStr substring
# mc magic character that must not exist in the orignal string.
# Defaults to the NULL character. Must be a single character.
# Results:
@ncimino
ncimino / .vimrc
Created April 23, 2013 22:38
vimrc, my vim and gvim configuration
" This must be first, because it changes other options as side effect
set nocompatible
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
"Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
#!/bin/sh
# To copy from the one file to several directories, use:
find -maxdepth 1 -mindepth 1 -type d -exec cp ${1} {} \;
@ncimino
ncimino / zip_content.sh
Created November 19, 2012 18:39
Bash loop through files - show zip contents
rm contents.txt
ls *.zip > filelist
for FILENAME in `cat filelist`
do
unzip -l $FILENAME >> contents.txt
done
rm filelist
@ncimino
ncimino / .gitignore
Last active October 11, 2015 19:08
Git Ignore All Except
*
!/a
/a/*
!/a/b
/a/b/*
!/a/b/c
/a/b/c/*
!/a/b/c/foo
# don't forget this one