Skip to content

Instantly share code, notes, and snippets.

@taiar
taiar / node.rb
Created February 27, 2017 12:39
Reverse binary trees
class Node
attr_accessor :left, :right, :value
def push(val)
if @value.nil?
@value = val
else
if(val > @value)
@left = Node.new if @left.nil?
@taiar
taiar / museomix_electrolab.md
Created January 18, 2017 18:16 — forked from leucos/museomix_electrolab.md
Hosting #museomix : providing real-world access to exhibits via sensors and actuators

Context

Museomix is a short event where coders, designers, hackers, cultural and museum experts brainstorm on collections and museum installations. This document gives hints on setting up an electronic lab so attendees can benefit from real-world interactions.

General considerations

Often, exhibits must sense their environment (is there light ? is there a visitor ? ...) or act on their environment (turn the light on ! make a sound ! ...).

Soldering team

@taiar
taiar / Elixir error timeout.txt
Created January 16, 2017 23:00
Elixir error timeout
➜ simple_word_count git:(master) ✗ elixir para_count.ex > tst
** (exit) exited in: GenServer.call(#PID<0.79.0>, {:get, #Function<0.38152131/1 in ParaCount.all/1>}, 5000)
** (EXIT) time out
(elixir) lib/gen_server.ex:737: GenServer.call/3
para_count.ex:7: ParaCount.run/0
(stdlib) timer.erl:166: :timer.tc/1
para_count.ex:43: Benchmark.measure/1
para_count.ex:49: (file)
@taiar
taiar / redshift.conf
Created January 12, 2017 00:03
redshift.conf
; Global settings
[redshift]
temp-day=6500K
temp-night=5000
transition=1
;gamma=0.8:0.7:0.8
gamma=1.000:1.000:1.000
;location-provider=geoclue
location-provider=manual
adjustment-method=vidmode
eyJhbmltYXRlIjpmYWxzZSwiYmdhbmltIjpmYWxzZSwiYm9udXNjb2lucyI6MjMsImNlZmZlY3RzIjpmYWxzZSwiY2xpY2tzIjoyNjcyMzIsImxldmVsMSI6eyJhbGx0aW1lY29pbnMiOjE4MTIyMTI2MjE5NTQ4NTk2LCJiYXNlY29zdCI6NjIzNzAzMDU4ODMzLCJiYXNlcyI6MTQwLCJiYXNlc3RyZW5ndGgiOjIyNTAwMCwiYmFzZXVwc2xldmVsIjo0LCJjbGlja3N0cmVuZ3RoIjoxNDg0Nzg3Nzg1OTguOTcyNSwiY2xpY2t1cHNsZXZlbCI6NSwiY29pbnMiOjYzNjU1NjAxOTc5ODQ4MDQsImV4dHJhc3RyZW5ndGgiOjIuMjUsImV4dHJhdXBzbGV2ZWwiOjUsImtlbm5lbGNvc3QiOjEzODQ0OTg0MzAxLCJrZW5uZWxzIjoxODIsImtlbm5lbHN0cmVuZ3RoIjo4NTAwLCJrZW5uZWxzdXBzbGV2ZWwiOjUsImtpdHRlbmNvc3QiOjI3NzE4ODk3MjYwLCJraXR0ZW5zIjoxNjEsImtpdHRlbnN0cmVuZ3RoIjoxMjMzNywia2l0dGVuc3Vwc2xldmVsIjo1LCJyaWdjb3N0Ijo5MjcwOTA2ODkyOTUyNSwicmlncyI6MTIwLCJyaWdzdHJlbmd0aCI6NDIwNDIwNDIwNCwicmlndXBzbGV2ZWwiOjQsInJvY2tldGNvc3QiOjI2NDUyNjI4MzQwLCJyb2NrZXRzIjoxMzEsInJvY2tldHN0cmVuZ3RoIjoxNTE4MCwicm9ja2V0dXBzbGV2ZWwiOjQsInNoaWJlY29zdCI6MzA2MDM0NDQyMSwic2hpYmVzIjoyMDEsInNoaWJlc3RyZW5ndGgiOjY1MDAsInNoaWJldXBzbGV2ZWwiOjV9LCJsZXZlbDIiOnsiYWxsdGltZWNvaW5zIjoyMDM4MTY0OTM1MjIuMjU0NTgsImJhc2Vjb3N0Ijox
@taiar
taiar / happy.rb
Created September 4, 2016 20:28
Happy numbers implementation
require 'byebug'
class Happy
def initialize(target)
@target = target
@happys = []
@unhappys = []
@path_numbers = []
@taiar
taiar / aliases.sh
Created June 10, 2016 17:38
Alias I like
alias gt='git status'
alias gc='git commit'
alias gp='git push origin $(git rev-parse --abbrev-ref HEAD)'
alias r='rails'
@taiar
taiar / start_mongo.sh
Created June 7, 2016 03:45
start_mongo
sudo mongod --dbpath /data/db
command-shift-P > Package > Package Generator: Generate Syntax Theme > mypackage
cd ~/.atom/packages/mypackage
apm login
apm develop mypackage
cd ~/github/mypackage
sudo chown -R username:wheel .
git commit -a -m 'checking everything in'
apm publish --tag v2.5.0 minor
@taiar
taiar / attr.rb
Created April 20, 2016 19:42
Array attribution
[].try((v.is_a? String) ? :<< : :+, v)