Skip to content

Instantly share code, notes, and snippets.

View jmlacroix's full-sized avatar

Jean-Michel Lacroix jmlacroix

View GitHub Profile
@jmlacroix
jmlacroix / keybase.md
Created April 16, 2021 14:30
Verifying my keybase

Keybase proof

I hereby claim:

  • I am jmlacroix on github.
  • I am jmlacroix (https://keybase.io/jmlacroix) on keybase.
  • I have a public key ASDFST83zy9tiI-huhZc6pTU_v7JfK8K_CX1BrJmHSFbKQo

To claim this, I am signing this object:

@jmlacroix
jmlacroix / samples.rb
Created October 30, 2012 19:08
Crash Course sur les Sockets - Présentation OpenCode 30 Octobre 2012
require 'socket'
# request through ruby TCPSocket
s = TCPSocket.open 'localhost', 4567
s.write "GET / HTTP/1.0\r\n\r\n"
s.read
s.close
@jmlacroix
jmlacroix / haskell.txt
Created December 3, 2011 00:27
Notes accompagnant la présentation "Introduction à la programmation fonctionnelle avec Haskell" du OpenCode 01-12-2011
Haskell (ghci)
Types de base
2
2 + 3.0
False
True == False
@jmlacroix
jmlacroix / highlight.sh
Created September 15, 2011 01:40
Use VIM to output HTML-formatted syntax highlight of a file
#/bin/bash
OUTFILE=$(mktemp -t highlight)
INFILE=$1
PARAM="set nonumber"
if [ -z "$INFILE" ]
then
echo "usage: $0 source.file"
@jmlacroix
jmlacroix / syntax.sh
Created September 15, 2011 01:39
Outputs VIM syntax highlight styles as CSS
#!/bin/bash
OUTFILE=$(mktemp -t syntax)
vim +'so $VIMRUNTIME/syntax/hitest.vim' \
+'let html_use_css=1' \
+'TOhtml' \
+'v/^\./d' \
+"wq! $OUTFILE" \
+'q!' &>/dev/null
@jmlacroix
jmlacroix / Rakefile
Created September 23, 2010 02:35
My jmlacroix.com-jekyll Rakefile to embed in a post
task :default => :server
desc 'Start server with --auto'
task :server do
jekyll('--server --auto')
end
desc 'Build site with Jekyll'
task :build do
jekyll('--no-future')
@jmlacroix
jmlacroix / aws_cf_sync.rb
Created September 23, 2010 02:06
Command line script to publish and invalidate a CloudFront website
local = ARGV[0]
s3_dest = ARGV[1]
if local == nil || s3_dest == nil
puts "syntax aws_cf_sync.rb local_source s3_dest"
exit
end
config = "#{Dir.pwd}/s3.config"
if !File.exists?(config)
@jmlacroix
jmlacroix / aws_cf_setroot.rb
Created September 22, 2010 05:23
Command line script to set the default root object of a cloudfront distribution
require 'rubygems'
require 'hmac-sha1'
require 'net/https'
require 'base64'
s3_access='S3_ACCESS_KEY'
s3_secret='S3_SECRET_KEY'
cf_distribution='CLOUDFRONT_DISTRIBUTION_ID'
newobj = ARGV[0]
@jmlacroix
jmlacroix / aws_cf_invalidate.rb
Created September 21, 2010 03:14 — forked from nbibler/amazon_cloudfront_invalidation.rb
Command line script to invalidate cloudfront objects
require 'rubygems'
require 'hmac-sha1'
require 'net/https'
require 'base64'
s3_access='S3_ACCESS_KEY'
s3_secret='S3_SECRET_KEY'
cf_distribution='CLOUDFRONT_DISTRIBUTION_ID'
if ARGV.length < 1
@jmlacroix
jmlacroix / iPatch.sh
Created April 14, 2010 17:05
Small bash script to prevent iTunes from opening when pressing media keys to control other applications such as Ecoute.
#!/bin/bash
IPATH="/Applications/iTunes.app/Contents/MacOS"
if [ ! -e "$IPATH/iTunesX" ]
then
sudo mv "$IPATH/iTunes" "$IPATH/iTunesX"
# has sudo failed?
if (( $? ))