Skip to content

Instantly share code, notes, and snippets.

View julienXX's full-sized avatar

Julien Blanchard julienXX

View GitHub Profile
@julienXX
julienXX / init_debug
Last active August 29, 2015 14:06
erl crash
λ erl -pa ebin deps/*/ebin
{error_logger,{{2014,9,4},{14,53,53}},"~s~n",["Error in process <0.23.0> with exit value: {undef,[{group,start,[<0.23.0>,{}],[]},{user_drv,start_user,0,[{file,\"user_drv.erl\"},{line,154}]},{user_drv,server1,3,[{file,\"user_drv.erl\"},{line,114}]}]}\n"]}
{error_logger,{{2014,9,4},{14,54,3}},crash_report,[[{initial_call,{supervisor_bridge,user_sup,['Argument__1']}},{pid,<0.22.0>},{registered_name,[]},{error_info,{exit,nouser,[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,322}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[kernel_sup,<0.10.0>]},{messages,[]},{links,[<0.11.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,346}],[]]}
{error_logger,{{2014,9,4},{14,54,3}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,nouser},{offender,[{pid,undefined},{name,user},{mfargs,{user_sup,start,[]}},{restart_type,temporary},{shutdown,2000},{child_type,supervisor}]}]}
{
(function($) {
var elCount = {};
var finishedCount = {};
$.fn.graphite = function(options) {
for(var i=0; i < $(this).length; i++){
$this = $(this[i]);
elCount[$this.attr('id')] = 0;
finishedCount[$this.attr('id')] = 0;
params = $.fn.graphite.initParams($this, options);
@julienXX
julienXX / gol.hs
Last active August 29, 2015 14:12
import System.Random
randomCells :: Int -> StdGen -> [Int]
randomCells size gen = take size $ randomRs (0, 1) gen
createGeneration :: [Int] -> Int -> [[Int]] -> [[Int]]
createGeneration [] _ generation = generation -- use _ when you don't use a variable
createGeneration cells width generation =
let line = take width cells
in createGeneration (drop width cells) width (line:generation)
import System.Random
import Data.List.Split
randomCells :: Int -> StdGen -> [Int]
randomCells size gen = take size $ randomRs (0, 1) gen
createGeneration :: [Int] -> Int -> [[Int]]
createGeneration cells width = splitEvery width cells
main :: IO() -- declare type signature
(require 'cl)
(defun is-magit-buffer (buffer)
(let ((name (buffer-name buffer)))
(and (= ?* (aref name 0))
(not (string-match "^\\*magit\\*" name)))))
(defun kill-magit-buffers ()
(interactive)
(loop for buffer being the buffers
@julienXX
julienXX / .bash_profile
Created May 25, 2009 12:43
my .bash_profile
# See following for more information: http://www.infinitered.com/blog/?p=19
# Path ------------------------------------------------------------
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH # OS-X Specific, with MacPorts and MySQL installed
#export PATH=/opt/local/bin:/opt/local/sbin:$PATH # OS-X Specific, with MacPorts installed
if [ -d ~/bin ]; then
export PATH=:~/bin:$PATH # add your bin folder to the path, if you have it. It's a good place to add all your scripts
fi
@julienXX
julienXX / update_google_chrome.sh
Created June 4, 2009 15:02 — forked from joefiorini/update_google_chrome.sh
Retrieve current Chromium build for Mac OS X
#!/bin/bash
set -e
BUILD_URL='http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/'
update_google_chrome() {
get_latest_revision_number
download_latest_revision
extract_code
@julienXX
julienXX / gist:151325
Created July 21, 2009 13:23
Script for LDAP user creation + skeleton
#!/bin/bash
#fx-useradd uid "first name" "last name"
PATH='/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin'
SKEL_PATH="/homes/skeleton"
usage() {
cat <<EOT
Usage: ${CMD} login first_name last_name
@julienXX
julienXX / gist:151289
Created July 21, 2009 11:11
empty an openLDAP group
./smbldap-groupshow.pl group_name | grep memberUid | cut -d" " -f2 | sed 's/user_to_keep_in\|user2_to_keep_in//g' | tr -s "," | xargs -i ./smbldap-groupmod.pl -x {} group_name
#!/usr/bin/env ruby
# Ruby script to generate SSHA (Good for LDAP)
require 'sha1'
require 'base64'
hash = "{SSHA}"+Base64.encode64(Digest::SHA1.digest(ARGV[0]+'salt')+'salt').chomp!
puts 'userPassword: '+hash+"\n"