Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Christophe Robin christopherobin

🏠
Working from home
  • Bloomberg LP
  • Tokyo, Japan
View GitHub Profile
@christopherobin
christopherobin / printUpdate.py
Created Sep 14, 2017
Pretty update information for yum distros
View printUpdate.py
#!/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 Aug 8, 2017
Dual screen wallpapers with hourly random change (gnome/mate)
View generate.sh
#!/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 Jun 27, 2017
This will take a folder full of images, resize them to the target size and stitch them side by side
View wallpapers.sh
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
View mage.d.ts
// 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 Mar 24, 2017
Gitlab CI compose-file
View gitlab.yml
version: "3.0"
networks:
net:
driver: overlay
traefik:
external:
name: traefik_net
volumes:
runner:
gitlab:
View playbook.yml
### 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
View gist:645e060b24a5a118f77c
# 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'
View gist:cc6a6cc2878b462fd19c
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
}
View monotonic.go
package main
// #include <time.h>
import "C"
import (
"fmt"
)
type TimeSpec struct {
@christopherobin
christopherobin / main.go
Created Aug 19, 2013
Working an ALPM (ArchLinux Package Manager) library for Go
View main.go
package alpm
// #cgo LDFLAGS: -lalpm
// #include <alpm.h>
import "C"
//import "fmt"
import "errors"
type ALPM struct {