Skip to content

Instantly share code, notes, and snippets.

View jppommet's full-sized avatar
🏠
Working from home

Jean-Pierre Pommet jppommet

🏠
Working from home
View GitHub Profile
@jppommet
jppommet / random-line-file.sh
Last active August 29, 2015 14:01
Pick a random line from a file
cat $FILE | sort --random-sort | head -n 1
# alternatively
rl -c 1 -n src/main/resources/and-feb10.csv
@jppommet
jppommet / cli_dup_line_file.txt
Created June 11, 2014 18:49
cli : print duplicated line from a file
$ uniq -d <file>
or
$ uniq -D <file>
Reference Link : http://www.thegeekstuff.com/2013/05/uniq-command-examples/
@jppommet
jppommet / git-alias.ini
Created July 23, 2014 20:28
useful git aliases
[alias]
amend = commit --amend -a
br = branch
co = checkout
ds = diff --staged
di = diff
fetchall = fetch -v --all
log-fancy = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
# With git >= 1.8.3 you can use %C(auto) for the branch decorator (%d)
log-fancy = log --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
@jppommet
jppommet / nvidia-driver-linux.txt
Last active August 29, 2015 14:04
official nvidia drivers running on linux
Check that your official nvidia driver is running properly on linux :
lspci -vnn | grep -i VGA -A 12
glxinfo | grep OpenGL | grep renderer
grep 'nouveau' /etc/modprobe.d/* | grep nvidia
lsmod | grep nvidia
modprobe -R nvidia
modinfo nvidia_<N>
@jppommet
jppommet / debugfs-inode.txt
Created July 25, 2014 15:09
Debug Info a file/directory via inode number
[sudo] debugfs -R 'stat <inode>' /dev/<device_name>
// by Erik Wrenholt
import java.util.*;
class Mandelbrot
{
static int BAILOUT = 16;
static int MAX_ITERATIONS = 1000;
private static int iterate(float x, float y)
{
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@jppommet
jppommet / npm-update-S
Created August 4, 2013 21:02
Update all the saved dependencies defined in your package.json. Useful. This command is not documented curiously.
npm update -S
@jppommet
jppommet / py-virtualenv-project-cmds
Last active December 22, 2015 07:59
python virtualenv project shell commands
# init a python project
pip install virtualenv
virtualenv --distribute <venv_dirname>
source <venv_dirname>/bin/activate
# install dependencies
pip install -r requirements.txt
# exit virtualenv mode
deactivate