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
@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:
### 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
# 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'
crobin@crobin-linux ~ $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
art/aeriscloud.nodejs <none> 2eb31902c905 32 minutes ago 701.7 MB
crobin@crobin-linux ~ $ docker inspect art/aeriscloud.nodejs
Error: No such image or container: art/aeriscloud.nodejs
[]
crobin@crobin-linux ~ $ docker inspect 2eb31902c905
[{
// proper inspect data
}
@christopherobin
christopherobin / monotonic.go
Created February 27, 2014 09:33
Golang Monotonic
package main
// #include <time.h>
import "C"
import (
"fmt"
)
type TimeSpec struct {
@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 {