Skip to content

Instantly share code, notes, and snippets.

Loic Nageleisen lloeki

Block or report user

Report or block lloeki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lloeki /
Last active May 27, 2018
Merge repos and keep whole history by creating a single multi-parent merge commit
set -e
set -u
set -o pipefail
lloeki /
Created Aug 27, 2015
Run Arch Linux in xhyve
tmp=$(mktemp -d)
pushd "$tmp"
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=$iso bs=2k skip=1 >> tmp.iso
echo "mounting disk"
lloeki /
Created Aug 27, 2015
Running debian 8.1 in xhyve
# unfortunately debian currently panics in xhyve
tmp=$(mktemp -d)
pushd "$tmp"
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
lloeki /
Last active May 14, 2018
Clean up /boot of unused Ubuntu (and Debian?) kernels
# Ubuntu has a stupid policy of not cleaning up boots because they deem
# unknowable whether a kernel is valid or not (even if booted). Combined with
# the default Ubuntu setup that creates a ridiculously small /boot that is
# bound to be filled in a few months worth of updates, you have a recipe for a
# failure during upgrade, leading to being unable to update or remove anything
# and having to mess with apt and dpkg innards by hand.
# This may work for Debian too.
# This one liner keeps /boot fresh and clean by removing the currently
# running kernel version as well as the latest one (which may not be
lloeki / main.go
Created May 1, 2015
Using GopherJS and Electron together
View main.go
// Electron's quick start sample, naively ported to Go
// go get -u gopherjs
// gopherjs build main.go
// electron $(pwd)
package main
import (
lloeki / gist:62239da19ec25f90f215
Created Dec 16, 2014
open-vm-tools with clipboard and drag and drop on Ubuntu 14.04 Trusty Tahr
View gist:62239da19ec25f90f215
# You should be using open-vm-tools instead of vmware tools, because package manager.
# Also I hate third parties that write out of /opt and /usr/local.
# open-vm-tools-desktop is badly packaged though, here are the missing links:
sudo apt-get install open-vm-tools open-vm-tools-desktop
# Reboot, and resize works, but no DnD nor clipboard
sudo mkdir /var/run/vmblock-fuse
sudo su -l -c "vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse"
# Now we have /run/vmblock-fuse populated.
# Adding an upstart rule in /etc/init is left as an exercise to the reader.
lloeki / brutalize_openssl.rb
Created Dec 2, 2014
Violently disable OpenSSL cert validation (dangerous!)
View brutalize_openssl.rb
require 'openssl'
class OpenSSL::SSL::SSLContext
def verify_mode
def verify_mode=(_)
@verify_mode = OpenSSL::SSL::VERIFY_NONE
lloeki / class_diagram.rake
Last active Aug 29, 2015
Rails class diagram (e.g models) with graphviz
View class_diagram.rake
# (c) Loic Nageleisen
# License: MIT
Node =, :name, :attributes)
Edge =, :from, :to, :name)
class DiagramGraph
def initialize
@nodes = []
@edges = []
lloeki / monad_id.rb
Created Sep 1, 2014
Identity monad in Ruby
View monad_id.rb
# Identity monad
class Identity
def initialize(value)
@value = value
# unit operation: Haskell 'return'
def self.munit(value)
View lua.go
package main
#cgo LDFLAGS: -lluajit-5.1
#include <stdlib.h>
#include <stdio.h>
#include <luajit-2.0/lua.h>
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
You can’t perform that action at this time.