Skip to content

Instantly share code, notes, and snippets.

@aumgn
aumgn / gist:864853
Created March 10, 2011 20:23
Abstractview implementation
module ViewMixin
def view_has?(key)
false
end
def view_section(key, contents)
# use #view_fetch to render section
end
Noyade:
- "<player> s'est noye"
- "<player> nage avec les poissons"
- "<player> explore les profondeurs"
- "<player> s'est pris pour Nemo"
Chute:
- "<player> a fait une chute mortelle"
- "<player> a tente un saut de la foi"
- "<player> est tombe de haut, un peu trop haut"
Vide:
@aumgn
aumgn / test.el
Created April 17, 2012 11:15
Emacs tests
(defun test (start end)
(interactive "r")
(print (match-etag (buffer-substring start end))))
; (message (number-to-string
; (count-occurence ?e (buffer-substring start end) 0))))
(defun count-occurence (char str accu)
(if (= (length str) 0)
accu
(if (char-equal char (string-to-char str))
(defun pretty-print1 ()
(interactive)
(beginning-of-buffer) ;; Retourne au debut du buffer
(setq level 0)
(while (search-forward-regexp "<[^\!]" nil t)
(let ((is-ending-tag (is-ending-tag)))
(if is-ending-tag
(setq level (- level 1)))
(indent-before-tag level)
(if (not is-ending-tag)
{
"timer": {
"major-duration": 120,
"minor-duration": 20,
"format": "%02d:%02d"
},
"lives": 5,
"start-duration": 20,
"totem-duration": 60,
"spawn-duration": 60,
@aumgn
aumgn / rbx_group_perm_bug.sh
Created October 31, 2012 13:41
Rubinius group file permission bug
>> id
uid=1000(aumgn) gid=1000(aumgn) groups=1000(aumgn),10(wheel),18(dialout),1001(vboxsf)
>> ll debug.rb
-rw-rw----. 1 aumgn aumgn 10 Oct 31 14:31 debug.rb
>> ruby -v
rubinius 2.0.0dev (1.9.3 release yyyy-mm-dd JI) [i686-pc-linux-gnu]
>> cat debug.rb
@aumgn
aumgn / Results
Created November 27, 2012 00:54
Grit/Graal Benchmark
Running each benchmark 1000 times.
Rehearsal ------------------------------------------------
Grit heads 0.000000 0.410000 0.410000 ( 5.257150)
Graal heads 1.150000 0.620000 4.130000 ( 36.643241)
--------------------------------------- total: 4.540000sec
user system total real
Grit heads 0.000000 0.160000 0.160000 ( 4.619689)
Graal heads 1.030000 0.590000 2.560000 ( 30.748539)
@aumgn
aumgn / ssh-agent.sh
Last active December 17, 2015 15:39
ssh-agent for Windows Contrary to most scripts available on the web, this one allows to use the same ssh-agent for all shell sessions. It works by specifiying an explicit socket '/tmp/ssh-agent' and using 'ps' to retrieve the pid.
function init_ssh_agent {
echo "Initializing new SSH agent..."
rm -f /tmp/ssh-agent
eval `ssh-agent -a /tmp/ssh-agent`
}
function setup_existing_ssh_agent {
echo "Using existing SSH agent..."
export SSH_AUTH_SOCK=/tmp/ssh-agent
export SSH_AGENT_PID=$(ps -s -u $USERNAME | grep ssh-agent | cut -d' ' -f4)
@aumgn
aumgn / DemoCommandSet.java
Last active December 22, 2015 02:18
Commands addition
public class DemoCommandSet implements CommandSet {
@Command(name="noargs")
public CommandOutcome noargs(CommandSender sender) {
// This command has no argument
return CommandOutcome.SUCCESS;
}
@Command(name="consoleonly")
public CommandOutcome consoleOnly(ConsoleCommandSender sender) {
@aumgn
aumgn / 0_reuse_code.js
Created April 9, 2014 17:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console