Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@mratsim
mratsim / upgrade-python3.sh
Created November 27, 2016 12:16
Upgrade all Python3 package on OSX
pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
@mratsim
mratsim / trimSSD.sh
Created November 27, 2016 12:18
Auto trim SSD
#!/bin/sh
#
# To find which FS support trim, we check that DISC-MAX (discard max bytes)
# is great than zero. Check discard_max_bytes documentation at
# https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt
#
for fs in $(lsblk -o MOUNTPOINT,DISC-MAX,FSTYPE | grep -E '^/.* [1-9]+.* ' | awk '{print $1}'); do
fstrim "$fs"
done
@mratsim
mratsim / chrome-cookies.sh
Created November 27, 2016 12:20
Get chrome cookies
#!/usr/bin/python
from sqlite3 import dbapi2 as db # python 2.5
cookie_file = '~/.config/chromium/Default/Cookies'
output_file = 'chrome-cookies.txt'
conn = db.connect(cookie_file)
cur = conn.cursor()
cur.execute('SELECT host_key, path, secure, expires_utc, name, value FROM cookies')
f = open(output_file, 'w')
i = 0
@mratsim
mratsim / newx.sh
Created November 27, 2016 12:22
Start program in different X window
DISPLAY=:1.0 xinit /path/to/program -- :1
@mratsim
mratsim / macros_TexStudio.txt
Created November 27, 2016 12:24
Macros to itemize, enumerate or wrap in function for TexStudio
%%Itemize
%SCRIPT
txt = cursor.selectedText()
txt = txt.replace(/^/gm, "\t\\item ")
editor.write("\\begin{itemize}\n"+txt+"\n\\end{itemize}\n")
cursor.clearSelection()
%%Enumerate
%SCRIPT
txt = cursor.selectedText()
@mratsim
mratsim / .bashrc
Created January 29, 2017 12:02
.bashrc config for Archlinux
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
date
echo
fortune | cowsay -f $(ls /usr/share/cows/ | shuf -n1)
echo
@mratsim
mratsim / .bashrc
Created January 29, 2017 12:03
.bashrc for OSX
date
echo
fortune | cowsay -f $(gls /usr/local/Cellar/cowsay/3.04/share/cows/ | gshuf -n1)
echo
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
if [ -f $HOME/.git-completion.bash ]; then
@mratsim
mratsim / .theanorc
Created January 29, 2017 12:04
Theano config with the fast Winograd kernel
[global]
floatX = float32
device = gpu
config.openmp = True
OMP_NUM_THREADS=8
config.dnn.conv.algo_fwd='winograd'
config.dnn.conv.algo_bwd_data='winograd'
config.gcc.cxxflags="-march=native"
[lib]
@mratsim
mratsim / yaourtrc
Created January 29, 2017 12:08
Yaourt config for Archlinux
# yaourtrc - Configuration for yaourt
#
# See yaourtrc(5) for more information
#
#
# General
#AUTOSAVEBACKUPFILE=0
DEVEL=1
DEVELSRCDIR="/pkg/devel"
@mratsim
mratsim / .screenrc
Last active January 29, 2017 12:22
Screenrc config for my Arch container
startup_message off
hardstatus alwayslastline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'
defscrollback 10000
termcapinfo xterm* ti@:te@
defutf8 on
defencoding utf8