Skip to content

Instantly share code, notes, and snippets.

View ThiefMaster's full-sized avatar
🐈
Scratching your code.

Adrian ThiefMaster

🐈
Scratching your code.
  • CERN / @indico
  • Geneva, Switzerland
View GitHub Profile

Nov 2018

Type Item CHF chEUR
Case [be quiet! Dark Base 700][1] 165
PSU [be quiet! Straight Power 11 650W][2] 110
Board [Asus ROG STRIX X470-F Gaming][3] 235
CPU [AMD Ryzen 7 2700X][4] 360
Cooler [Noctua NH-D15 SE-AM4][5] 100
GPU [MSI RTX 2070 Gaming Z][6] 700
@ThiefMaster
ThiefMaster / .gitconfig
Last active September 18, 2018 12:13
my git config
[alias]
lg = log --color=always --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lga = log --color=always --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=iso
purr = pull --rebase
puff = pull --ff-only
mff = merge --ff-only
fall = fetch --all
pigamend = "!f(){ git add -u && git commit --amend --no-edit; }; f"
[color]
ui = auto
# use your actual postgres/zodb connection details here
export PG=postgresql:///indico
export ZODB=zeo://127.0.0.1:9675
# use the id of your "system" user. create one first if you have none
export JANITOR_UID=123
# specify the path to your indico archive dir
export ARCHIVE=/opt/indico/archive
# specify the name of the StorageBackends indico.conf entry pointing to fs:$ARCHIVE
export ARCHIVE_BACKEND=default
@ThiefMaster
ThiefMaster / tmux-smartsplit.sh
Last active April 27, 2017 07:36
Automatically ssh to the current pane's target if applicable
#!/bin/bash
# tmux-smartsplit
# open a new tmux (split-)window which will automatically
# continue the existing ssh session if one exists
PID=$(tmux display-message -p -F "#{pane_pid}")
if [[ $(readlink /proc/$PID/exe) == $(which ssh) ]]; then
CHILD=$PID
else
CHILD=$(cat /proc/[0-9]*/stat | awk '$4 == '$PID' {print $1; exit}')
local avatar = ARGV[1]
local user_events = redis.call('ZRANGE', 'user_events:'..avatar, 0, -1)
local res = {}
for i, event in ipairs(user_events) do
res[event] = redis.call('SMEMBERS', 'user_event_roles:'..avatar..':'..event)
end
return cjson.encode(res)
function urlFromHash() {
if (location.hash.substr(0, 2) != '#!') {
return null;
}
// why not location.hash? => http://stackoverflow.com/q/4835784/298479
return location.href.split('#')[1].substr(1);
}
$('#gallery').magnificPopup({
type: 'image',
@ThiefMaster
ThiefMaster / copy.c
Created September 6, 2012 11:51
copy
/* Copy a regular file from SRC_NAME to DST_NAME.
If the source file contains holes, copies holes and blocks of zeros
in the source file as holes in the destination file.
(Holes are read as zeroes by the `read' system call.)
When creating the destination, use DST_MODE & ~OMITTED_PERMISSIONS
as the third argument in the call to open, adding
OMITTED_PERMISSIONS after copying as needed.
X provides many option settings.
Return true if successful.
*NEW_DST is as in copy_internal.
__auto_venv() {
local venv="$HOME/.python-env"
local current="$VIRTUAL_ENV"
local ps1
# check if we are REALLY inside a venv and not just inherited $VIRTUAL_ENV
if ! type -t deactivate > /dev/null; then
current=""
fi
@ThiefMaster
ThiefMaster / promptrc.sh
Created December 23, 2013 00:55
a nice bash prompt
# vim: ft=sh
function set_prompt {
local BLACK="\[\033[0;30m\]"
local BLUE="\[\033[0;34m\]"
local GREEN="\[\033[0;32m\]"
local CYAN="\[\033[0;36m\]"
local RED="\[\033[0;31m\]"
local PURPLE="\[\033[0;35m\]"
local BROWN="\[\033[0;33m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
@ThiefMaster
ThiefMaster / darkblue_256.vim
Created December 22, 2013 16:46
darkblue.vim, modified to look good fine on xterm-256color
" Vim color file
" Maintainer: Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Last Change: 2006 Apr 30
" darkblue -- for those who prefer dark background
" [note: looks bit uglier with come terminal palettes,
" but is fine on default linux console palette.]
set bg=dark
hi clear