Skip to content

Instantly share code, notes, and snippets.

View herczy's full-sized avatar

Hercinger Viktor herczy

  • Balabit Europe Kft.
  • Veszprém
View GitHub Profile
@thwarted
thwarted / sshpub-to-rsa
Created June 14, 2011 09:12
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@herczy
herczy / gist:876156
Created March 18, 2011 14:27
Show git status in bash prompt
git_branch()
{
# Check if we are on an untrached branch
ISUNTRACKED=$(git branch 2>/dev/null | grep '* (no branch)' | wc -l)
# Checks the branch name
BRANCH=$(git branch 2>/dev/null | grep '*' | awk '{ print $2 }')
if [ "x$BRANCH" != "x" ]; then
if [ "x$ISUNTRACKED" != "x0" ]; then
echo -ne ':\033[31;1mUNTRACKED('$(git log --oneline -1 | awk '{ print $1 }')')\033[0m'