Skip to content

Instantly share code, notes, and snippets.

@hashar
hashar / node-unstable.rb
Created October 18, 2011 15:48
mac homebrew formula for NodeJS v0.5.9
# This formula provide NodeJS v0.5.9 for Mac Homebrew
#
# Install this node-unstable.rb file in your `brew --prefix` directory
# Then:
# $ brew install node-unstable
#
# Formula was uploaded originally for v0.5.7 originally at:
# https://raw.github.com/bramswenson/homebrew/94c4104e50a95c111710ab7bc52cc2f7417db712/Library/Formula/node-unstable.rb
#
# Unfortunately, NodeJS 0.5.7 or 0.5.8 do not provide child_process.fork()
@hashar
hashar / clonemwext.sh
Created July 11, 2012 19:21
script to clone MediaWiki extensions from Gerrit easily
#!/bin/bash
#
# Lame script to easily clone a MediaWiki extension from Gerrit to current dir
#
# License: GPLv2
# Author : Antoine "hashar" Musso
REMOTE_NAME="gerrit"
REMOTE_PATTERN="ssh://hashar@gerrit.wikimedia.org:29418/mediawiki/extensions/\$1.git"
@hashar
hashar / testgluster.c
Created July 31, 2012 19:13
move a file and crash gluster!
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main() {
puts( "Writing file 'ORIG_HEAD.lock'!" );
FILE *file;
file = fopen( "ORIG_HEAD.lock", "w+" );
@hashar
hashar / build.xml
Created September 5, 2012 12:43
ant: antcall from javascript script
<project default="main">
<target name="main">
<script language="javascript"> <![CDATA[
task = project.createTask( 'macro' );
if( task.getOwningTarget() == null ) {
task.log( "Assigning an owner ..." );
task.setOwningTarget( self.getOwningTarget() );
task.log( "Task: " + task.getOwningTarget() );
}
@hashar
hashar / android_bootstrap.sh
Created October 16, 2012 15:55
shell script to install Android SDK from CLI
#!/bin/bash
ANDROID_ARCHIVE="android-sdk_r20.0.3-linux.tgz"
ANDROID_URL="http://dl.google.com/android/$ANDROID_ARCHIVE"
BASE_DIR="/opt/androidsdk"
ANDROID_BIN="$BASE_DIR/android-sdk-linux/tools/android"
ANDROID_VERSIONS="android-8,android-10"
### Pre checks ########
@hashar
hashar / define.yaml
Created December 10, 2012 15:41
Jenkins Job Builder, override a parameter at project level
# Testing Jenkins Job Builder
#
# git clone git://gist.github.com/4251317.git
# mkdir testoutput
# jenkins-jobs -l debug test 4251317 -o testoutput
# grep command outtemplate/*
# Basic macro, takes a 'parameters' parameter
- builder:
name: resolve-deps
#!/bin/bash
# You will need a file named 'gerrit-projects' containing the list of projects
# gerrit ls-projects > gerrit-projects
# The refs/meta/config file for each project is then downloaded. Slashes are
# replaced by dash and filename is suffixed with '.config'.
GITWEB="https://gerrit.wikimedia.org/r/gitweb?p=<PROJECT>.git;a=blob_plain;f=project.config;hb=refs/meta/config"
for project in `cat gerrit-projects`; do
echo "Checking out $project.."
try:
if not args.force and (
os.path.getmtime(filepath) <=
os.path.getmtime(zonefilepath)):
continue
except OSError:
# destination file not found
pass
if not args.force:
# Verify whether template is fresh
outdated = os.path.getmtime(filepath) <= os.path.getmtime(zonefilepath)
if not outdated:
continue # skip file generation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
text = """
- bar
+ foo
- Le text est fort
+ Le texte est fort