Skip to content

Instantly share code, notes, and snippets.

View aspyct's full-sized avatar

Antoine d'Otreppe aspyct

View GitHub Profile
@aspyct
aspyct / upstart.sh
Created February 3, 2014 12:54
Upstart script
description "My service"
author "Antoine d'Otreppe <a.dotreppe@aspyct.org>"
start on runlevel [35]
stop on runlevel [0126]
exec /path/to/script.sh
respawn
@aspyct
aspyct / vimrc.vim
Last active August 29, 2015 13:56
My vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
syntax on
set hidden
set backspace=indent,eol,start
set nu
@aspyct
aspyct / rvmsudo.sh
Last active August 29, 2015 13:56
rvmsudo
rvmsudo rvm 1.9.3 do rake install prefix=/usr/local
@aspyct
aspyct / cdscript.sh
Created February 17, 2014 09:10
Go to script's directory
cd `dirname $BASH_SOURCE`
c = compile("print('hello')", "noFile", "exec")
f = FunctionType(c, globals())
f()
@aspyct
aspyct / belgian-address.pcre
Last active August 29, 2015 14:10
Parse a belgian street address
^
(?# street - required)([^/\n]+?)
(?# separator)[\s,]+
(?# number - required)(\d[\w-]*)
(?# box - optional)(?:\s*(?:bte|bus|boite|box|/)\s*(.+?))?
(?# trailing whitespaces)\s*
$
(?#
FIXME: how to make a difference between a ‘/‘ and ‘/b’,
when the ‘b’ could be part of the box?
@aspyct
aspyct / flickr.sh
Created February 20, 2015 19:55
Publish images to Flickr
FLICKR="$HOME/Flickr"
for image in "$@"
do
basename=$(basename $image)
imagename=${basename%.*}
extension=${basename##*.}
counter=1
filename=$basename
@aspyct
aspyct / NodeJs example .js
Created June 26, 2012 12:45
A short dependency container for javascript / node applications
> var sb = new ServiceBox();
> sb.msg = "Hello World";
> var handler = sb.wrap(function (prefix) {
... console.log(prefix);
... console.log(this.msg);
... });
> handler("this is the prefix");
this is the prefix
Hello World
@aspyct
aspyct / sayhello.py
Created January 24, 2014 09:41
Funny python method swap
def sayHello():
print("hello")
def sayBye():
sayBye()
sayHello, sayBye = sayBye, sayHello
@aspyct
aspyct / AppDelegate.cs
Created April 28, 2016 08:13
Share on facebook page with Xamarin (Requires "Facebook iOS SDK component")
using Facebook.CoreKit;
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return ApplicationDelegate.SharedInstance.FinishedLaunching (application, launchOptions);
}