Skip to content

Instantly share code, notes, and snippets.

@zzOzz
zzOzz / gitconfig.ini
Created January 19, 2017 09:08 — forked from tdd/gitconfig.ini
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
st = status
@zzOzz
zzOzz / gist:1a12485befeb1ffd600732ffa8923761
Created February 1, 2017 19:56
Restore Linux file "rm"
If a running program still has the deleted file open, you can recover the file through the open file descriptor in /proc/[pid]/fd/[num]. To determine if this is the case, you can attempt the following:
$ lsof | grep "/path/to/file"
If the above gives output of the form:
progname 5383 user 22r REG 8,1 16791251 265368 /path/to/file
take note of the PID in the second column, and the file descriptor number in the fourth column. Using this information you can recover the file by issuing the command:
$ cp /proc/5383/fd/22 /path/to/restored/file
If you're not able to find the file with lsof, you should immediately remount the file system which housed the file read-only:
kubectl get replicaset -o json|jq '.items[]|select(.status.replicas == 1)|.metadata.name' -r
ipset -N tor iphash
curl 'https://check.torproject.org/torbulkexitlist?ip=' | xargs -n 1 ipset -A tor
iptables -A INPUT -m set --match-set tor src -j DROP