Skip to content

Instantly share code, notes, and snippets.

View apraga's full-sized avatar

Alexis Praga apraga

View GitHub Profile
@apraga
apraga / tmux.conf
Created November 30, 2012 09:59
Tmux configuration
# 256 colors
set -g default-terminal screen-256color
set-window-option -g xterm-keys on
# Scrolling
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
@apraga
apraga / vimrc
Created November 30, 2012 10:09
Vim config
" Do you want bepo configuration ? 0 if not
let want_bepo = 1
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
@apraga
apraga / capture_video.sh
Created December 21, 2012 13:37
Script for video recording.
# !/bin/sh
ffmpeg -f x11grab -s 1280x800 -r 25 -i :0.0+nomouse -s hd720 -vcodec libx264 -vpre lossless_ultrafast -an -threads 0 $1
@apraga
apraga / gist:4352902
Created December 21, 2012 13:39
Script for converting to mp3 from various formats.
#!/bin/bash
DEFAULT_OUTPUT_DIR=/tmp/mp3ify
QUALITY=2
VBR_QUALITY=4
MIN_BITRATE=320
MAX_BITRATE=320
SAMPLE_FREQ=44.1
@apraga
apraga / getcoretemp.sh
Created December 21, 2012 13:39
Returns the cores temperatures.
#!/bin/bash
temp1=`cat /sys/devices/platform/coretemp.0/temp2_input`
temp2=`cat /sys/devices/platform/coretemp.0/temp3_input`
echo `expr $temp1 / 1000`C `expr $temp2 / 1000`C
@apraga
apraga / notify.sh
Created December 21, 2012 13:40
Mail notification with procmail and libnotify.
#!/bin/bash
# popup a small notification with 'notify-send'
dis=`formail -X From: -X Subject:`
from=`echo "$dis" | formail -X From:`
sub=`echo "$dis" | formail -X Subject:`
# tweaks < > are special
from=${from//</\(}
from=${from//>/\)}
from=${from//&/\.}
@apraga
apraga / date_example.c
Created February 3, 2014 11:30
How to manage date in C
#include <time.h>
#include <stdio.h>
int main (void) {
time_t cur;
time_t next;
struct tm curtime;
struct tm nexttime;
Install xmonad
In .xinitrc :
setxkbmap fr bepo
setxkbmap -option "ctrl:swapcaps"
exec xmonad
Useful programs :
* stow => clone dotfiles
* keychain => add config to bashrc
@apraga
apraga / gist:22bff5d8e5681907e70a
Created February 20, 2016 19:40
rtorrent post
d.multicall=incomplete,d.stop=
d.multicall=incomplete,d.directory.set=test
@apraga
apraga / kdtree.py
Last active June 25, 2017 22:08
Example of searching a KD Tree with Scipy
from scipy.spatial import KDTree
import numpy as np
import itertools
import matplotlib.pyplot as plt
import random
pos = np.zeros((10, 2))
for (i, j) in itertools.product(range(10), range(2)):
pos[i,j] = random.randint(0, 10)