Skip to content

Instantly share code, notes, and snippets.

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

Maxime Demolin MaximeD

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am maximed on github.
  • I am mdemolin (https://keybase.io/mdemolin) on keybase.
  • I have a public key ASAcf4RIgsgCFpye8tDdoK21hlm9KnAokPDiK9pfDfzdBQo

To claim this, I am signing this object:

#!/bin/sh
# Full repository name (group and project)
repo=$(echo $(git ls-remote --get-url) | sed 's/git@github.com:\(.\+\)\.git/\1/')
# Branch name
branch=$(git rev-parse --abbrev-ref HEAD)
# Display link to pull request
echo "Create pull request for pre-push_hook:"
echo -e "\thttps://github.com/$repo/compare/$branch?expand=1"
@MaximeD
MaximeD / pet-snippet.toml
Created August 12, 2017 15:58
description
[[snippets]]
description = "Replace tab with spaces"
command = "find . -name $1 ! -type d -exec bash -c 'expand -i -t 2 \"$0\" > /tmp/e && mv /tmp/e \"$0\"' {} \\;"
[[snippets]]
description = "Empty log files"
command = "find . -iname \"*.log\" | xargs truncate --size 0"
[[snippets]]
description = "[YOUBOOX] copy database structure"
@MaximeD
MaximeD / pet-snippet.toml
Created March 13, 2017 13:25
description
[[snippets]]
description = "Replace tab with spaces"
command = "find . -name $1 ! -type d -exec bash -c 'expand -i -t 2 \"$0\" > /tmp/e && mv /tmp/e \"$0\"' {} \\;"
[[snippets]]
description = "Empty log files"
command = "find . -iname \"*.log\" | xargs truncate --size 0"
#!/bin/sh
repo=$(echo $(git ls-remote --get-url) | sed 's/git@github.com:\(.\+\)\.git/\1/')
branch=$(git rev-parse --abbrev-ref HEAD)
echo "See or create pull request at:"
echo -e "\thttps://github.com/$repo/compare/$branch?expand=1"
exit 0
@MaximeD
MaximeD / swap_bench.rb
Created February 27, 2013 20:31
swap variables
#!/usr/bin/env ruby
a = 2
b = 4
50000000.times do
a = a ^ b
b = a ^ b
a = a ^ b
end
@MaximeD
MaximeD / prod_mat.java
Created October 31, 2012 12:03
Compute the matrix multiplication of two matrices
class prod_mat {
public static void main(String[] args) {
int [][] a = {
{5,1},
{2,3},
{3,4}
};
int [][] b = {
{1,2,0},
{4,3,-1}
@MaximeD
MaximeD / 50-joystick.conf
Created June 3, 2012 14:54
No joypad control mouse
# /etc/X11/xorg.conf.d/50-joystick.conf
Section "InputClass"
Identifier "joystick catchall"
MatchIsJoystick "on"
MatchDevicePath "/dev/input/event*"
Driver "joystick"
Option "StartKeysEnabled" "False"
Option "StartMouseEnabled" "False"
EndSection
@MaximeD
MaximeD / vim_vs_emacs.rb
Created May 28, 2012 06:32
vim / emacs length
#!/usr/bin/env ruby
# encoding: utf-8
vim = [
"Ma configuration Vi / Vim / gVim - theClimber",
"Chapitre 16. Vim : un éditeur de texte",
"Ultimate Vim Config | Steve Francia's Epic Blog",
"Vim - Configuration complete (Page 1) / Logiciels éducatifs ...",
"vim - Documentation Ubuntu Francophone",
"The ultimate Vim configuration - vimrc",
@MaximeD
MaximeD / list2grps.rb
Created February 13, 2012 12:48
Randomize an etudiant list into groups !
#!/usr/bin/env ruby
etudiants = ["Name1", "Name2", ... , "Namen"] ;
def extract(etudiants)
random_number = rand(etudiants.length)
etudiant = etudiants[random_number]
return etudiants.delete(etudiant)
end