Skip to content

Instantly share code, notes, and snippets.

#
# library part
#
defprotocol PerxistentProto do
def refresh o
def save! o
end
defmodule Perxistent do
# Define 2 vectors
cars <- c(1, 3, 6, 4, 9)
trucks <- c(2, 5, 4, 5, 12)
# Graph cars using a y axis that ranges from 0 to 12
plot(cars, type="o", col="blue", ylim=c(0,12))
# Graph trucks with red dashed line and square points
lines(trucks, type="o", pch=22, lty=2, col="red")
@mprymek
mprymek / gist:e257abc5e39afe01d928
Created June 25, 2014 22:19
R - set values in vector to the nearest value from the given boundaries vector
to_nearest = function(d,bounds) {
lapply(d,FUN=function(x){
idx=which.min(abs(bounds-x))
bounds[idx]
})
}
There's a problem with https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel/cli.ex#L327
### with Erlang 17.1
# /usr/local/bin/mix
No file named /usr/local/bin/mix
# ls -l /usr/local/bin/mix
lrwxr-xr-x 1 root wheel 21 Jun 29 11:52 /usr/local/bin/mix -> ../lib/elixir/bin/mix
defmodule MyApp.Plug.Mobile do
import Plug.Conn
def init(options), do: options
@default_layout "application"
def call(conn, opts) do
layout = case get_req_header(conn,"user-agent") do
[ua|_] ->
cond do
<SOME_DN>=real user DN...
add-primgroup.ldif:
############################################
dn: <SOME_DN>
changetype: modify
replace: primaryGroupID
primaryGroupID: 513
############################################
Quiz for web developers:
What's this?!
"\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"[[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
@mprymek
mprymek / zc
Last active August 29, 2015 14:07
US klávesnice s českými písmeny pro X11
// US klavesnice s ceskymi pismeny
//
// Uz nikdy trapeni s vimem, ceskymi znaky a nekonecnym prepinanim klavesnic ;)
// Idealni pro klavesnice s us popisem.
//
// Az na male vyjimky kompletne stejna klavesnice jako standardni us:
//
// rada 2-0 obsahuje ceske znaky stejne jako na cz klavesnici
// s shiftem specialni znaky jako na us klavesnici
// s pravym altem cisla
#! py
import os.path
def run():
files = {}
pillar_root = __opts__['pillar_roots'][__env__][0]
priv_root = '%s/_priv/%s'%(pillar_root,__opts__['id'])
for dirname, dirnames, fnames in os.walk(priv_root):
for fname in fnames:
defmodule Exlog do
defmacro __using__ _opts do
quote do
import Exlog
end
end
def new do
{:ok,e} = :erlog.new
e