Skip to content

Instantly share code, notes, and snippets.

@bsmr
bsmr / tmux.conf
Created May 29, 2016 15:25 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@bsmr
bsmr / I2C_Adapter.ino
Created May 29, 2016 15:16 — forked from kraftb/I2C_Adapter.ino
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
#!/bin/bash
# === global variables ================================================
LOCKBASE="/var/lock" # old
#LOCKBASE="/run/lock" # new
# === support functions ===============================================
# --- display usage information ---------------------------------------
action_usage() {
BN=$(basename $0)
@bsmr
bsmr / masking.lisp.log
Created December 10, 2015 06:46
mask integer values
CL-USER> #xa1
161
CL-USER> #xb2
178
CL-USER> #xc3
195
CL-USER> #xd4
212
CL-USER> #xa1b2c3d4
2712847316
@bsmr
bsmr / elixir Regex example
Created August 13, 2015 07:54
elixir Regex example
iex(1)> s1 = "Hello, World!"
"Hello, World!"
iex(2)> s2 = "ボリスくん"
"ボリスくん"
iex(3)> Regex.scan(~r/\S/, s1)
[["H"], ["e"], ["l"], ["l"], ["o"], [","], ["W"], ["o"], ["r"], ["l"], ["d"],
["!"]]
iex(4)> Regex.scan(~r/\S/, s2)
[[<<227>>], [<<131>>], [<<156>>], [<<227>>], [<<131>>], [<<170>>], [<<227>>],
[<<130>>], [<<185>>], [<<227>>], [<<129>>], [<<143>>], [<<227>>], [<<130>>],
@bsmr
bsmr / log-elixir-master-erlang-R18.0rc2
Last active August 29, 2015 14:23
failing unit tests for elixir-git-master on erlang-git-otp-r18-rc2
==> elixir (exunit)
1) test update maps (MapTest)
test/elixir/map_test.exs:45
Expected exception ArgumentError but got ErlangError (erlang error: {:badkey, :c})
stacktrace:
test/elixir/map_test.exs:48
2) test protocol defines callbacks (ProtocolTest)
@bsmr
bsmr / setup-erlang-elixir
Created June 23, 2015 11:24
create Erlang and Elixir from git
cd /opt/erlang/
echo $LANG
export OLD_LANG=$LANG
export LANG=C
cd /opt/erlang/git/otp/
git fetch origin
git checkout maint
git pull origin maint
git checkout OTP-18.0-rc2
git checkout -b build-OTP-18.0-rc2
@bsmr
bsmr / hosts
Created May 30, 2015 06:53
example /etc/hosts file
#
# /etc/hosts
#
127.0.0.1 localhost
192.168.0.1 system1.mynet.local master node1
192.168.0.2 system2.mynet.local slave node2
::1 ip6-localhost ip6-loopback