Skip to content

Instantly share code, notes, and snippets.

View olih's full-sized avatar

Olivier Huin olih

View GitHub Profile
@olih
olih / zsh-alias-git.sh
Created March 17, 2015 16:29
Helpful aliases for git for zsh when using a rebase workflow
#GIT Alias
alias latest='git checkout master;git fetch --all;git rebase;git status;'
alias br='git show-branch;git branch;git status;'
alias h2='git rebase -i HEAD~2'
alias h3='git rebase -i HEAD~3'
alias h4='git rebase -i HEAD~4'
alias h5='git rebase -i HEAD~5'
alias h6='git rebase -i HEAD~6'
@olih
olih / install-basic.sh
Last active August 29, 2015 14:23
A few basic tools to install by default
#!/bin/bash
sudo yum install -y epel-release
sudo yum install -y nano
sudo yum install -y git
#Install Amazon Client
curl -O http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py
#Install pip
sudo easy_install pip
@olih
olih / install-aws.sh
Last active August 29, 2015 14:28
install-aws.sh
#AWS
# . install-aws.sh
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
aws_session_token=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep Token | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
@olih
olih / tango-normalize-aluminium.py
Last active December 15, 2015 18:39
Normalise SVG picture to Tango Aluminium colours
import sys
import os
import re
def normalize(filename):
(root, ext)=os.path.splitext(filename)
filename2 = root + "-norm"+ ext
print "Normalizing ", filename2
f=open(filename, 'r')
@olih
olih / SearchFiles
Created April 8, 2013 15:37
Search files on Mac OS
#Finds a list of jar files
find . -name \*.jar -print
#Using an alias
#Usage list *.jar
function list { find . -name "$1" -print ;}
export -f list
#Search text in files, recursive, ignore case, with file and line number:
grep -Hirn term *.txt
@olih
olih / FileEncrypt
Created April 8, 2013 15:43
Encrypt/Decrypt files Mac Os
#Decrypt the file enigma.txt
enc -d -aes128 -base64 -in enigma.txt -pass pass:****
#Converts p12 to pem
openssl pkcs12 -in mypass.p12 -out mypass.pem -clcerts
@olih
olih / FileSearch.scala
Created April 11, 2013 14:39
Searches for files in a directory hierarchy matching a given pattern
import scala.xml._
import scala.xml.transform._
import java.io.File
import scala.util.matching.Regex
import scala.util.matching.Regex.Match
/**
Creator: 2013, Olivier Huin (https://github.com/olih)
License: Eclipse Public License - v 1.0
Contributors:
*/
@olih
olih / HtmlBeautifier.scala
Created April 18, 2013 14:23
Process a html document and reformat it nicely. Beautifier
import scala.xml._
import scala.xml.transform._
import java.io._
import xml._
/**
Creator: 2013, Olivier Huin (https://github.com/olih)
License: Eclipse Public License - v 1.0
Contributors:
*/
/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */
body {
padding-bottom: 40px;
color: #5a5a5a;
}