Skip to content

Instantly share code, notes, and snippets.

@jbruggem
jbruggem / backup.sh
Last active August 29, 2015 14:17
Mysql dump one file per table
#!/bin/bash
username="$1"
password="$2"
for dbName in `mysql --skip-column-names -u $username -p$password -e 'show databases;'`; do
echo "db: $dbName"
mkdir -p "dump/$dbName/"
for tableName in `mysql --skip-column-names -u $username -p$password $dbName -e 'show tables;'`; do
echo "table: $tableName"
function forceFail(name){ return function(){
console.trace('force failed: ', name);
process.exit(1);
}}
@jbruggem
jbruggem / fish_prompt.fish
Created May 31, 2013 12:57
Fish function with git repo branch shown.
# this should go to ~/.config/fish/functions/fish_prompt.fish
# Set the default prompt command. Make sure that every terminal escape
# string has a newline before and after, so that fish will know how
# long it is.
function fish_prompt --description "Write out the prompt"
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)

Keybase proof

I hereby claim:

  • I am jbruggem on github.
  • I am jbruggem (https://keybase.io/jbruggem) on keybase.
  • I have a public key whose fingerprint is 88DF BDF7 A546 4AFD DF94 6DFB D4BE 7779 B8B1 CD34

To claim this, I am signing this object:

@jbruggem
jbruggem / check.sh
Created April 11, 2017 09:42
Bash recipe: several commands in an "exit || "
grep -q docker /proc/self/cgroup || { echo "not in docker"; exit 1; }
@jbruggem
jbruggem / application.py
Created November 14, 2017 16:27 — forked from anonymous/application.py
Health check for python application via unix sockets
import os
import time
import socket
from threading import Timer
SOCKET_PATH="/var/run/appname_health/socket"
state = 0
def main():
# use after a long running task to be notified using notify-send
# e.g.: `./tests.sh; notifydone`
alias notifydone="RES=\$?; while true; do echo \"done. Return value: \${RES}. Ctrl-C to stop notifications\"; notify-send 'Run ended' \"Execution return val: \${RES}\"; sleep 60; done"
// ==UserScript==
// @name hubic delete
// @version 1
// @grant none
// @include https://hubic.com/home/*
// @require https://cdn.jsdelivr.net/npm/async@2.6.0/dist/async.min.js
// ==/UserScript==
var originalLocation;
// TODO: where does it hang ?
# at the end of ~/.bashrc
// ==UserScript==
// @name WaPo accept GDPR
// @version 1
// @grant none
// @include https://www.washingtonpost.com/gdpr-consent/*
// @namespace https://symzo.be/gm
// ==/UserScript==
function waitForContinueButton(then){