Skip to content

Instantly share code, notes, and snippets.

@hashar
hashar / gist:7215603
Created October 29, 2013 14:22
are function args in exceptions traced passed by reference?
<?php
# Example for https://gerrit.wikimedia.org/r/#/c/92334/
function blame($a) {
throw new Exception();
}
try {
blame( array('foobar') );
} catch (Exception $e) {
hashar@gallium:~$ tail -n15 /srv/ssd/jenkins-slave/workspace/mwext-Wikibase-qunit/LocalSettings.php
# End of automatically generated settings.
# Add more configuration options below.
$wgWikimediaJenkinsCI = true;
require_once( '/var/lib/jenkins/tools/extensions-loader.php' );
ini_set( 'display_errors', 1 );
@hashar
hashar / ssh_config
Created July 26, 2013 13:52
SSH config to connect to Wikimedia Labs instances
Host *.wmflabs.org
IdentityFile ~/.ssh/labs_id_rsa.pub
IdentitiesOnly yes
User hashar
Host *.wmflabs
User hashar
Host bastion.pmtpa.wmflabs
Hostname bastion.wmflabs.org
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
text = """
- bar
+ foo
- Le text est fort
+ Le texte est fort
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
try:
if not args.force and (
os.path.getmtime(filepath) <=
os.path.getmtime(zonefilepath)):
continue
except OSError:
# destination file not found
pass
#!/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.."
@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
@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 / 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() );
}