Skip to content

Instantly share code, notes, and snippets.

View christopherobin's full-sized avatar
🏠
Working from home

Christophe Robin christopherobin

🏠
Working from home
  • Bloomberg LP
  • Tokyo, Japan
View GitHub Profile
@christopherobin
christopherobin / printUpdate.py
Created September 14, 2017 08:06
Pretty update information for yum distros
#!/usr/bin/env python
import rpm
import yum
from operator import itemgetter
def colorize(str, col):
return "\x1b[%d;1m%s\x1b[0m" % (col, str)
@christopherobin
christopherobin / generate.sh
Created August 8, 2017 02:27
Dual screen wallpapers with hourly random change (gnome/mate)
#!/bin/sh
# Drop all your images in a folder, let's call it /tmp/wallpapers then run this
# Take all your files from the output folder and put them somewhere in your
# home folder (like ~/Pictures/Wallpapers)
RES=$( xrandr | grep primary | awk '{ print $4 }' | cut -d '+' -f 1 )
mkdir output 2>/dev/null
for a in *.{png,jpg,tga}; do
for b in *.{png,jpg,tga}; do
### Ansible setup
# We don't want all the pip installs and various dependencies to conflict with
# normal yum packages, this solves the issue by creating an ansible virtualenv
# and tells ansible to use it
###
- hosts: all
become: true
tasks:
- name: "Create deployment folder"
file: path=/opt/deploy state=directory mode=0755
@christopherobin
christopherobin / wallpapers.sh
Created June 27, 2017 06:31
This will take a folder full of images, resize them to the target size and stitch them side by side
SCREEN_RES=2560x1440
mkdir result 2>/dev/null || true
for a in *.jpg; do for b in *.jpg; do
[[ "$a" != "$b" ]] && \
convert \
"$a" -resize "${TARGET_RES}^" -gravity center -crop "${TARGET_RES}+0+0" +repage \
"$b" -resize "${TARGET_RES}^" -gravity center -crop "${TARGET_RES}+0+0" +repage \
+append "result/${a}-${b}";
done; done
// Type definitions for MAGE 1.0.2
// Project: https://github.com/mage/mage
// Definitions by: Christophe Robin <crobin@nekoo.com>
/// <reference types="node" />
import events = require('events');
declare namespace mage {
interface IMage {
@christopherobin
christopherobin / gitlab.yml
Created March 24, 2017 09:59
Gitlab CI compose-file
version: "3.0"
networks:
net:
driver: overlay
traefik:
external:
name: traefik_net
volumes:
runner:
gitlab:
@christopherobin
christopherobin / main.go
Created August 19, 2013 11:52
Working an ALPM (ArchLinux Package Manager) library for Go
package alpm
// #cgo LDFLAGS: -lalpm
// #include <alpm.h>
import "C"
//import "fmt"
import "errors"
type ALPM struct {
@christopherobin
christopherobin / cryptopp.patch
Created June 27, 2013 05:47
Patch for cryptopp in custom bitcoin extension
Index: cryptopp/algebra.cpp
===================================================================
--- cryptopp/algebra.cpp (revision 5)
+++ cryptopp/algebra.cpp (working copy)
@@ -58,7 +58,7 @@
Element g[3]={b, a};
unsigned int i0=0, i1=1, i2=2;
- while (!Equal(g[i1], this->Identity()))
+ while (!this->Equal(g[i1], this->Identity()))
@christopherobin
christopherobin / test.js
Created April 26, 2013 04:25
Connection to the MtGox websocket using node.js Websocket library: https://github.com/Worlize/WebSocket-Node
var websocket = require('websocket');
var client = new websocket.client();
client.on('connectFailed', function() { console.log(arguments); });
client.on('connect', function(conn) {
console.log('connected!');
conn.on('message', function(message) {
console.log(message);
# First shell
docker run --name foobar --rm -t -i ubuntu bash
# Another shell
# Change URL to docker API, under linux you can quickly expose it: socat -d -d TCP-LISTEN:8080,fork UNIX:/var/run/docker.sock
curl -XPOST 'localhost:8080/commit?container=foobar&comment=foo&repo=test/foobar@foo:bar'