Skip to content

Instantly share code, notes, and snippets.

View alexcp's full-sized avatar

Alexandre Croteau-Pothier alexcp

View GitHub Profile
@alexcp
alexcp / autoexec.cfg
Last active June 3, 2017 18:57
Counter Strike: Global Offensive Configs
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3;+lookatweapon"
bind "4" "slot4"
bind "5" "slot5"
bind "9" "slot9"
bind "a" "+moveleft"
bind "b" "buymenu"
bind "v" "+voicerecord"
bind "d" "+moveright"
@alexcp
alexcp / missing_index.rb
Created February 5, 2015 20:24
scan migrations to find possible missing index
#!/usr/bin/env ruby
def files
results = %x{grep --include="*_create_*" -r "index: true" db/migrate -l}
results.split("\n")
end
def display_affected_columns
files.each do |file|
lines = open(file){|f| f.readlines}
@alexcp
alexcp / training.cfg
Created October 7, 2014 12:49
CS:GO Training config
// I always join CT so I add bot to T side
bind "ç" "bot_add t"
// **MUST HAVE BOT IN SERVER** - bind a key to place a bot
bind "à" "bot_place"
// Press this once to get all nades after round restarts
bind "^" "give weapon_hegrenade;give weapon_flashbang;give weapon_smokegrenade;give weapon_molotov;sv_infinite_ammo 1"
// Press this to enable noclip
@alexcp
alexcp / .tmux.conf
Created December 17, 2013 18:54
tmux config
# binding to look like vim
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
## set title to tmux
#set -g set-titles on
#set -g set-titles-string 'tmux'
@alexcp
alexcp / ball.rb
Created December 13, 2013 14:46
pong
class Ball
attr_reader :x, :y, :angle, :speed
SIZE = 16
def initialize
@x = Pong::WIDTH/2
@y = Pong::HEIGHT/2
@angle = rand(120) +30
@angle *= -1 if rand > 0.5
# finished level6
class Player
def play_turn(warrior)
@warrior = warrior
action
save_health
end
def side
if wall_behind?
@alexcp
alexcp / pdf_to_text.rb
Last active December 19, 2015 12:49
Ruby script to convert pdf to plain text
#!/bin/env ruby
require 'find'
require 'pdf-reader'
Dir.chdir "#{Dir.pwd}/pdf"
Find.find('./') do |path|
if path.match /\.pdf/
File.open path, "rb" do |io|
content = ""
@alexcp
alexcp / gist:5808127
Created June 18, 2013 18:47
Print the supported 256 colors
( x=`tput op` y=`printf %$((${COLUMNS}-6))s`;for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;done; )
@alexcp
alexcp / gist:5798317
Created June 17, 2013 16:45
alias to copy current app production ip
alias prodip="cat config/deploy/production.rb | grep -o '[0-9.]*' | xclip -selection 'clipboard'"
@alexcp
alexcp / gist.sh
Last active December 18, 2015 04:59
Fix display drivers issue in ubuntu
sudo apt-get --purge remove xserver-xorg-video-nouveau
sudo apt-get install linux-headers-`uname -r`
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
sudo update-alternatives --config gl_conf
sudo update-alternatives --config x86_64-linux-gnu_gl_conf
sudo ldconfig
sudo update-initramfs -u
sudo nvidia-xconfig