Skip to content

Instantly share code, notes, and snippets.

@tychobrailleur
tychobrailleur / gist:8753725
Last active August 29, 2015 13:55
Emacs Lisp experimentations
(defun project-euler-1 (n)
"Implementation for Project Euler 1"
(let ((sum 0))
(dotimes (i n)
(if (or (= 0 (% i 3)) (= 0 (% i 5)))
(setq sum (+ sum i))))
sum))
(project-euler-1 1000)
(defvar memoize (make-hash-table :test 'equal))
@tychobrailleur
tychobrailleur / gist:8785720
Created February 3, 2014 15:19
Link Kanbanery story to Barkeep commit.
#!/usr/bin/env ruby
require 'json'
require 'httparty'
require 'logger'
KB_PROJECT_ID = 12345
GITHUB_TOKEN_ID = 'abcdef'
project_location = project = 'my_project'
project = ARGV[0] if !ARGV.empty?
%
% my-local-deps.pl
% marelle-deps
%
meta_pkg('my-local-deps', [
cntlm,
git,
tig,
emacs,
@tychobrailleur
tychobrailleur / timers.el
Created February 28, 2014 12:34
Play with Emacs timers.
(defvar counter 0)
(defun print-message ()
(setq counter (1+ counter))
(message "Hello World %s" counter))
(run-with-timer 20 20 'print-message)
(cancel-timer (car timer-list))
➋ greystones:~/tmp (master)$ cat main.rs
fn main() {
println!("Hello World!");
}
➋ greystones:~/tmp (master)$ rustc main.rs
➋ greystones:~/tmp (master)$ ls -al | grep main
-rwxr-xr-x 1 sebastien sebastien 3049726 mars 23 15:36 main
-rw-r--r-- 1 sebastien sebastien 43 mars 23 15:35 main.rs
@tychobrailleur
tychobrailleur / gist:10547221
Last active August 29, 2015 13:59
Generate random Irish town names
# coding: utf-8
PREFIXES = ['Gal', 'Glan', 'Glas', 'Kil', 'Lough', 'Rath', 'Ty', 'Ennis', 'Dun', 'Dolly']
SUFFIXES = ['bally', 'farne', 'ealy', 'liney', 'cullen', 'coole', 'cock', 'nagh', 'negal', 'garvan', 'gloe', 'corthy', 'kerry']
number = ARGV[0].to_i || 5
number.times { puts PREFIXES.sample + SUFFIXES.sample }
@tychobrailleur
tychobrailleur / examples.txt
Last active August 29, 2015 13:59
Generate Names of Middle-Earth Locations
Galadhir
Galadgorn
Isentirith
Núrdûr
Galadtirith
Isenmorgul
Dagordel
Fandale
Isendûr
Galadbad
require 'wavefile'
def sine_samples(sample_rate, duration, frequency)
total_frames = (duration*sample_rate).to_i
samples = []
total_frames.times.map do |k|
samples << Math.sin(2*Math::PI*frequency*k/sample_rate)
end
samples
import java.util.concurrent.DelayQueue
import java.util.concurrent.Delayed
import java.util.concurrent.TimeUnit
long start = System.currentTimeMillis()
class DelayObject implements Delayed {
def data
def triggerTime
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007ff2683cb4e8, pid=8904, tid=140678909056768
#
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b02) (build 1.7.0_80-ea-b02)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x5624e8] PhaseCFG::schedule_early(VectorSet&, Node_List&)+0x1f8
#