Skip to content

Instantly share code, notes, and snippets.

View calbrecht's full-sized avatar

Christian Albrecht calbrecht

View GitHub Profile
@calbrecht
calbrecht / echo-cancel
Created March 9, 2015 05:46
DBus monitor empathy call state and setup module-echo-cancel with webrtc on pulseaudio
#!/bin/bash
case $1 in
dbus-monitor)
interface=org.freedesktop.Telepathy.Channel.Type.Call1
member=CallStateChanged
dbus-monitor "interface='$interface',member='$member'" |
while read -r line; do
[[ "$line" =~ ^signal ]] && LINENUM=1 || LINENUM=$((LINENUM + 1))
@calbrecht
calbrecht / .i3-config
Created May 8, 2015 09:37
.i3/config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@calbrecht
calbrecht / fix-nix-meta-helper
Created December 12, 2015 17:57
helper script metadata for fixing nixos nix pkgs metadata
#!/usr/bin/env bash
test -d nixpkgs && test -f nixpkgs/default.nix || {
echo Must run this script in parent of $nixpkgs_dir git root
exit 1
}
test -d gentoo || {
git clone https://anongit.gentoo.org/git/repo/gentoo.git
}
@calbrecht
calbrecht / php-version-manager.sh
Created August 10, 2013 09:49
PHP Version Manager utilizing update-alternatives
#!/bin/bash
if [ "$EUID" != "0" ]; then
sudo $0 $@;
exit 1;
fi
BIN_DIR=/usr/bin
PHP_DIR=/usr/local/php;
PHP_VERSION=""
@calbrecht
calbrecht / node-version-manager.sh
Created August 10, 2013 09:50
nodejs Version Manager utilizing update-alternatives
#!/bin/bash
if [ "$EUID" != "0" ]; then
sudo $0 $@;
exit 1;
fi
BIN_DIR=/usr/bin
NODE_DIR=/usr/local/node;
NODE_VERSION=""
@calbrecht
calbrecht / test-vagrant-lxc.sh
Created September 8, 2013 18:15
vagrant-lxc provider test
#!/bin/bash
if [[ "root" != "$(whoami)" ]] ; then
echo 'Err: you must be root to run this script'
exit 1
fi
if [[ ! $(which vagrant >/dev/null) ]] ; then
wget http://files.vagrantup.com/packages/b12c7e8814171c1295ef82416ffe51e8a168a244/vagrant_1.3.1_x86_64.deb
dpkg -i ./vagrant_1.3.1_x86_64.deb
@calbrecht
calbrecht / PhpStormVagrantPhpUnit.php
Last active December 24, 2015 06:59
Run PhpUnit from wihtin PhpStorm through vagrant on virtual machine. Use this file as Custom Loader. See http://www.jetbrains.com/phpstorm/webhelp/phpunit.html
<?php
/** Full path to project dir on host */
isset($_SERVER['HOST_DIR']) or $_SERVER['HOST_DIR'] = realpath(__DIR__ . '/../../');
/** Full path to vagrant directory on host */
$_SERVER['VAGRANT_DIR'] = $_SERVER['HOST_DIR'] . '/vagrant';
/** Full path to project dir on virtual machine */
$_SERVER['GUEST_DIR'] = '/path/to/project/on/vm';
@calbrecht
calbrecht / check.nix
Last active January 17, 2016 18:13
Detect licenses from sources of derivation with ninka for derivations without meta.license info
#? nix-instantiate check.nix | xargs --max-procs 4 -n 1 -- nix-store -k -r --option use-binary-caches false
#? find /nix/store -name *ninka-licenses-builder* | xargs -n1 -I@ nix-store --delete @
#? find /nix/store -name '*ninka-licenses*' | xargs -n1 -I@ -- nix-store --delete @
#? find /nix/store -type d -name *ninka-licenses* | xargs -n1 -I@ -- sh -c 'nix-store --dump @ > `basename @`.nar'
with builtins;
with {
inherit (import ./nixpkgs/pkgs/top-level/all-packages.nix {
config = { allowBroken = true; allowUnfree = true; };
}) stdenv pkgs;
}; let
@calbrecht
calbrecht / CX20-container.nix
Last active June 20, 2017 16:39
nixops hetzner mailserver
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
{
ngse = { config, pkgs, ... }: rec
{
deployment.targetEnv = "container";
deployment.container = {
host = "localhost";
clientPublicKey = "~/.ssh/id_nixops.pub";
clientPrivateKey = "~/.ssh/id_nixops";
@calbrecht
calbrecht / lxc-from-vmdk.sh
Created May 8, 2015 08:20
create sles lxc container within mounted img from vmdk img.
#!/usr/bin/env bash
test 0 != $(id -u) && { echo "sudo ${0} ${@}"; sudo ${0} ${@} && exit 0 || exit 1; }
BOX_NAME=sles11sp3
AUTOINST=https://raw.githubusercontent.com/jedi4ever/veewee/master/templates/SLES-11-SP3-DVD-x86_64-GM/autoinst.xml
BOX_HOME=${HOME}/.vagrant.d/boxes/${BOX_NAME}/0/virtualbox
BOX_VMDK=${BOX_HOME}/box-disk1.vmdk