Skip to content

Instantly share code, notes, and snippets.

View olih's full-sized avatar

Olivier Huin olih

View GitHub Profile
@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
@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 / alias_tar.sh
Created May 23, 2013 11:30
Create a tar or tar.gz archive with a date using the ISO 8601 format. 1. Install the functions with your aliases (ex: .bash_profile MacOS) 2. Usage: tard folder tarzd folder
function tard { tar cvf $1-$(date +%Y-%m-%dT%H:%MZ).tar $1;}
export tard
function tarzd { tar cvfz $1-$(date +%Y-%m-%dT%H:%MZ).tar.gz $1;}
export tarzd
@olih
olih / LibraryReview.md
Last active December 19, 2015 01:39
Key elements for reviewing a library
  • name
  • description
  • version
  • keywords
  • homepage
  • author
  • repository
  • licenses
  • stars
  • updated
@olih
olih / pageviewcost.coffee
Created July 31, 2013 15:37
Basic calculation of cost/revenue by page viewed
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
#Very basic page view cost calculator
#Dollar conversion
D= 0.65
@olih
olih / id.coffee
Created August 6, 2013 14:21
Generate numeric ids
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
#This code is a quick hack and should not be used for production
#as it is not optimized and the random numbers could be predicted.
@olih
olih / convert.coffee
Created August 6, 2013 16:23
A few examples of simple conversions
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
pairToMap= (key,value)->
row=
Name: key
Value: value
@olih
olih / adwords.py
Last active December 20, 2015 18:18
Analysis of adwords
#!/usr/bin/python
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
import sys, getopt
import csv
@olih
olih / ps.py
Created August 9, 2013 14:08
List all the linux/MacOs processes (ps -A) Kill all the processes with a given name
#!/usr/bin/env python
# encoding: utf-8
"""
Executes a ps
Kill all processes with a given name
Creator: 2013, Olivier Huin (https://github.com/olih)
License: Eclipse Public License - v 1.0
Contributors:
"""
@olih
olih / password.coffee
Created August 14, 2013 11:09
Generate a random password for admin purposes
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
# Generates a random password
#This code is a quick hack and should not be used for production
#as it is not optimized and the random numbers could be predicted.
G=10000000000