Skip to content

Instantly share code, notes, and snippets.

View jbourassa's full-sized avatar
🎣
Gone fishing

Jimmy Bourassa jbourassa

🎣
Gone fishing
View GitHub Profile
@jbourassa
jbourassa / gist:1365031
Created November 14, 2011 20:24
Installed brew formulas
# brew list -l | sed "s/.* \([a-z0-9\-]*\)$/\1/g"
ack
cmake
ctags
gettext
git
graphicsmagick
imagemagick
jasper
@jbourassa
jbourassa / .tmux.conf
Created November 15, 2011 16:54
Last tmux itch I still have
# Any way to fix this? =(
# <prefix>-y sends the buffer to pbcopy
unbind y
bind y save-buffer /tmp/tmux-buffer \; run-shell "reattach-to-user-namespace -l zsh -c 'cat /tmp/tmux-buffer|pbcopy'"
@jbourassa
jbourassa / can you crack it.txt
Created December 11, 2011 01:06
Can you crack it
eb 04 af c2 bf a3 81 ec 00 01 00 00 31 c9 88 0c
0c fe c1 75 f9 31 c0 ba ef be ad de 02 04 0c 00
d0 c1 ca 08 8a 1c 0c 8a 3c 04 88 1c 04 88 3c 0c
fe c1 75 e8 e9 5c 00 00 00 89 e3 81 c3 04 00 00
00 5c 58 3d 41 41 41 41 75 43 58 3d 42 42 42 42
75 3b 5a 89 d1 89 e6 89 df 29 cf f3 a4 89 de 89
d1 89 df 29 cf 31 c0 31 db 31 d2 fe c0 02 1c 06
8a 14 06 8a 34 1e 88 34 06 88 14 1e 00 f2 30 f6
8a 1c 16 8a 17 30 da 88 17 47 49 75 de 31 db 89
d8 fe c0 cd 80 90 90 e8 9d ff ff ff 41 41 41 41
-----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBpenis1ePqHkVN9IKaGBESjV6zBrIsZc+XQYTtSlVa9R/4SAXoYpI
upNrIjkCLd6DLDqfTO429xLDmYO4Ojzox7xiNcSMlBn8+TqTjf3TqAJmIOpgQVhJ
vW9is30teT7l2ynAyMYvGqwR0liCToMc/lOltlhPIFixw2AKUd0M5W76dwIDAQAB
AoGBAKDl8vuA9zUn2lTDddujAzBRp8ZEoJTxw7BVdLpZtgLWLuqPcXroyTkvBJC/
rbfPgYDdmgWc/lkpMufFe/TC+KgIDlWo50Pm/cwcChaM9nEINbFF1dqoA5gVxv6g
yUWQNKVKerToh/L3OpbiApArfB2a iimXUDH0eiGev6i6h0ShAkEA/MCm4KwarMP9
gPy2V/9qlJ1mEgZXMjHG4nWBfgPQE+9Lq1+e6kMePpuFgAC5ZJC8an4PC0LU5QIV
XBUW2uLG0QJBAMbVClSWms3llVT5IjKFNLdz0ShSu0Fh5UzRpMkxtEGYsO5VKnb4
Psg1RMTRceI/z3d/3BiuDjiUiRICFqOXDscCQQDFea/ocg8VVLvH/6pn7oNTQfbx
@jbourassa
jbourassa / app_one.php
Created April 26, 2012 01:52
Attempt to share entities in Doctrine2
<?php
// This is the namespace `app:` would resolve to.
namespace AppOne;
/**
* @Entity(repositoryClass="SomeClass...")
* @Table(name="user")
*/
class User extends Shared\User {
// Extend the class here if need be
}
@jbourassa
jbourassa / cases.py
Created June 3, 2012 20:59
Udacity Exam - 6 tests
example4 = [ \
("assign", "x", ("binop", ("identifier","a"), "+", ("identifier","b"))) ,
("assign", "y", ("binop", ("identifier","b"), "+", ("identifier","c"))) ,
("assign", "z", ("binop", ("identifier","c"), "+", ("identifier","d"))) ,
("assign", "b", ("binop", ("identifier","c"), "+", ("identifier","d"))) ,
("assign", "z", ("number", 5)) ,
("assign", "p", ("binop", ("identifier","a"), "+", ("identifier","b"))) ,
("assign", "q", ("binop", ("identifier","b"), "+", ("identifier","c"))) ,
("assign", "r", ("binop", ("identifier","c"), "+", ("identifier","d"))) ,
]
@jbourassa
jbourassa / provinces.rb
Created June 13, 2012 18:37
Add provinces to Spree
# encoding: utf-8
canada = Spree::Country.find_by_iso('CA')
Spree::State.delete_all country_id: canada.id
provinces = [
{ name: "Québec", abbr: "QC" },
{ name: "Ontario", abbr: "ON" },
{ name: "British Columbia", abbr: "BC" },
{ name: "Alberta", abbr: "AB" },
{ name: "Manitoba", abbr: "MB" },
{ name: "Saskatchewan", abbr: "SK" },
@jbourassa
jbourassa / readme.md
Created July 17, 2012 23:25
Défi OpenCode 5

Défi OpenCode 5 : bit.ly/oc-5

Faire un décompte qui affiche le temps d'ici au prochain OpenCode.

  • Étape 1 : Obtenir http://opencode.ca
  • Étape 2 : Extraire la date de .subtitle em et la parser en date. Svp cacher le résultat pour ne pas exploser DreamHost
  • Étape 3 : ??
  • Étape 4 : Faire un décompte qui montre le temps entre maintenant et le prochain OpenCode.

bonus de karma++ si le compteur est un widget HTML facile à intégrer sur n'importe quel site.

@jbourassa
jbourassa / helper.rb
Created September 10, 2012 15:21
spaceless in rails
# from http://stackoverflow.com/questions/6925176/spaceless-equivalent-of-django-templates-in-rails
# test edit.
def spaceless(&block)
contents = capture(&block)
# Note that string returned by +capture+ is implicitly HTML-safe,
# and this mangling does not introduce unsafe changes, so I'm just
# resetting the flag.
contents.strip.gsub(/>\s+</, '><').html_safe
end
@jbourassa
jbourassa / replace_key.sh
Created September 17, 2012 14:23
Replace your public key for all users
for f in /home/*
do
if [ -f "$f/.ssh/authorized_keys" ]
then
sudo sed -i "s|OLD_KEY|NEW_KEY|g;" "$f/.ssh/authorized_keys"
fi
done