Skip to content

Instantly share code, notes, and snippets.

@spangey
Last active August 29, 2015 14:12
Show Gist options
  • Save spangey/f01f909ac66dce951305 to your computer and use it in GitHub Desktop.
Save spangey/f01f909ac66dce951305 to your computer and use it in GitHub Desktop.
http://nullprogram.com/blog/2012/06/08/
https://wiki.debian.org/Subkeys?action=show&redirect=subkeys
https://futureboy.us/pgp.html
# nigget patented poormans wget ! lulz
#this doesnt work as alsia.. need to think about making the alias work
alias nigget=(echo 'GET /'; echo; sleep 1; ) | telnet $1 80
Thus, switching to AES-256, SHA-512 or any algorithm with a big, mean-looking number, will not give you "more security". It will give you a feeling of safety, in the same way that red cars are often believed to be faster. If that's your thing, then, by all means, use AES -- after all, one point of security is to reduce anxiety. But, scientifically, algorithm switching is not necessary. GnuPG defaults to CAST5 and SHA-1 because this maximizes interoperability with older implementations of OpenPGP.
make zsh your default shell:
$ chsh
Changing shell for afsilva.
Password:
New shell [/bin/bash]: /bin/zsh
.zshrc
case $TERM in
xterm*)
precmd () {print -Pn "\e]0;%m: %~\a"}
ssh(){
PRENAME="`dcop $KONSOLE_DCOP_SESSION sessionName`";
dcop "$KONSOLE_DCOP_SESSION" renameSession "$@";
/usr/bin/ssh "$@";
dcop "$KONSOLE_DCOP_SESSION" renameSession "$PRENAME" }
;;
esac
alias biggest='find -type f -printf '\''%s %p\n'\'' | sort -nr | head -n 40 | gawk "{ print \$1/1000000 \" \" \$2 \" \" \$3 \" \" \$4 \" \" \$5 \" \" \$6 \" \" \$7 \" \" \$8 \" \" \$9 }"'
function spangelbrot {
local lines columns colour a b p q i pnew
((columns=COLUMNS-1, lines=LINES-1, colour=0))
for ((b=-1.5; b<=1.5; b+=3.0/lines)) do
for ((a=-2.0; a<=1; a+=3.0/columns)) do
for ((p=0.0, q=0.0, i=0; p*p+q*q < 4 && i < 32; i++)) do
((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
done
((colour=(i/4)%8))
echo -n "\\e[4${colour}m "
# echo-n "SpangelBrot TM 2015"
done
echo
done
}
~/.gnupg/gpg.conf
# when multiple digests are supported by all recipients, choose the strongest one:
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
# preferences chosen for new keys should prioritize stronger algorithms:
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
# when making an OpenPGP certification, use a stronger digest than the default SHA1:
cert-digest-algo SHA512
# when outputting certificates, view user IDs distinctly from keys:
fixed-list-mode
# long keyids are more collision-resistant than short keyids (it's trivial to make a key with any desired short keyid)
keyid-format 0xlong
# If you use a graphical environment (and even if you don't) you should be using an agent:
# (similar arguments as https://www.debian-administration.org/users/dkg/weblog/64)
use-agent
# You should always know at a glance which User IDs gpg thinks are legitimately bound to the keys in your keyring:
verify-options show-uid-validity
list-options show-uid-validity
# include an unambiguous indicator of which key made a signature:
# (see http://thread.gmane.org/gmane.mail.notmuch.general/3721/focus=7234)
sig-notation issuer-fpr@notations.openpgp.fifthhorseman.net=%g
.bashrc
############
alias psx="ps -auxw ¦ grep $1"
################### Begin gpg functions ##################
encrypt ()
{
# Use ascii armor
gpg -ac --no-options "$1"
}
bencrypt ()
{
# No ascii armor
# Encrypt binary data. jpegs/gifs/vobs/etc.
gpg -c --no-options "$1"
}
decrypt ()
{
gpg --no-options "$1"
}
pe ()
{
clear
echo " cryptxt";
echo "--------------------------------------------------"; echo "";
which $EDITOR &>/dev/null
if [ $? != "0" ];
then
echo "It appears that you do not have a text editor set in your
.bashrc file.";
echo "What editor would you like to use ? " ;
read EDITOR ; echo "";
fi
echo "Enter the name/comment for this message :"
read comment
$EDITOR passphraseencryption
gpg --armor --comment "$comment" --no-options --output
passphraseencryption.gpg --symmetric passphraseencryption
shred -u passphraseencryption ; clear
echo "Outputting passphrase encrypted message"; echo "" ; echo "" ;
cat passphraseencryption.gpg ; echo "" ; echo "" ;
shred -u passphraseencryption.gpg ;
read -p "Hit enter to exit" temp; clear
}
#need to study full implications of this
# exec ssh-agent gpg-agent --daemon bash
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
GPG_TTY=$(tty)
export GPG_TTY
alias biggest='find -type f -printf '\''%s %p\n'\'' | sort -nr | head -n 40 | gawk "{ print \$1/1000000 \" \" \$2 \" \" \$3 \" \" \$4 \" \" \$5 \" \" \$6 \" \" \$7 \" \" \$8 \" \" \$9 }"'
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment