Skip to content

Instantly share code, notes, and snippets.

View olih's full-sized avatar

Olivier Huin olih

View GitHub Profile
@olih
olih / weppage.coffee
Created May 2, 2013 15:28
Useful user data for a web page
renderer:
template: "the template to use"
template_type: "the template engine"
url: "the address of the page"
headers:
content_language: "The language the content is in (en,fr)"
last_modified: "The last modified date for the requested object, in RFC 2822 format"
expires: "Gives the date/time after which the response is considered stale"
etag: "An identifier for a specific version of a resource, often a message digest"
head:
@olih
olih / coffeetojson.sh
Last active December 16, 2015 21:50 — forked from aral/coffeetojson.sh
Converts a coffee-json file to json as an alias. Requires node.js and coffeescript.
#On MacOS, adds this to your .bash_profile
function json { coffee --print --bare $1.coffee | sed '1s/&.//' | sed 's/});/}/' | sed 's/({/{/' | sed "s/\([^ '\"].*[^ '\"]\): /\"\1\": /1" > $1.json ;}
export -f json
/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */
body {
padding-bottom: 40px;
color: #5a5a5a;
}
@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:
*/
@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 / 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 / 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 / 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')