Skip to content

Instantly share code, notes, and snippets.

View Martiusweb's full-sized avatar

Martin Richard Martiusweb

View GitHub Profile
@Martiusweb
Martiusweb / zombies.c
Created August 9, 2018 20:35
TLPI 26-2
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
/**
* assuming grand parent, parent and child:
*
@Martiusweb
Martiusweb / commit-msg
Created January 11, 2017 10:20
git hook: Grep for a JIRA ticket ID in a commit message
#!/bin/sh
gtest "" = "$(grep '[A-Z]\+-[0-9]\+' "$1")" && {
echo >&2 "Sorry, I can't find a JIRA ticket ID in this commit message"
exit 1
}
@Martiusweb
Martiusweb / .gitignore
Created October 30, 2014 14:30
.dotfiles
[alias]
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
lg = !"git lg1"
co = checkout
ci = commit
br = branch -a -vv
st = status
[core]
editor = vim
@Martiusweb
Martiusweb / rectoverso
Created June 30, 2014 13:30
Merge two piles of scanned documents
#!/bin/bash
# usage rectoverso file1.pdf file2.pdf
# require "stapler" (pip2 install stapler)
file1=$1
file2=$2
stapler split $file1
stapler split $file2
@Martiusweb
Martiusweb / bash_log_utils.sh
Last active August 29, 2015 14:02
Bash log utils
# S: Step
# O: Operation
# D: Debug
# C: Command (and its output)
log_step() {
LOG_PREPREND=$@
log "S $@"
}
diff -r 18c21532848a browser/base/content/browser-places.js
--- a/browser/base/content/browser-places.js Wed Jun 11 09:58:02 2014 +0100
+++ b/browser/base/content/browser-places.js Fri Jun 13 18:40:22 2014 +0200
@@ -1458,6 +1458,9 @@
[translateX, translateY] = getCenteringTransformForRects(dropmarkerNotifierRect, dropmarkerRect);
let dropmarkerTransform = "translate(" + translateX + ", " + translateY + ")";
+ // Play a Mario 1Up sound. The best !
+ new Audio(this._mario_1up).play();
@Martiusweb
Martiusweb / monitor_io.stp
Created April 14, 2014 09:50
Monitor some IO operations on Linux
#!/usr/bin/env stap
/* Usage:
* monitor_io.stp (data|metadata|all) [with_lookup]
*
* - data: monitor reads/writes (currently, reads only)
* - metadata: monitor metadata reads/writes
* - all: monitor both
*/
function is_block_device:long(dentry:long) {
@Martiusweb
Martiusweb / dropdown.html
Created October 12, 2011 17:29
An example of JS dropdown
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
@author Martin Richard <martius@martiusweb.net>
@license Licensed under WTFPL
-->
<script>
var dropDown_show = function(elt) {