Skip to content

Instantly share code, notes, and snippets.

View excavador's full-sized avatar

Oleg Tsarev excavador

View GitHub Profile
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
(function(){var e,n,t,a,i;t={spline:["#2f7ed8","#0d233a","#8bbc21","#910000","#1aadce","#492970","#f28f43","#77a1e5","#c42525","#a6c96a"],area:["#49006a","#7a0177","#ae017e","#dd3497","#f768a1","#fa9fb5","#fcc5c0","#fde0dd","#fff7f3","#ffffff"],stacked:["#49006a","#7a0177","#ae017e","#dd3497","#f768a1","#fa9fb5","#fcc5c0","#fde0dd","#fff7f3","#ffffff"]},i={area:{area:{lineWidth:0,marker:{enabled:!1}}},stacked:{area:{lineWidth:0,stacking:"normal",marker:{enabled:!1}}},spli
#include <iostream>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <uv.h>
#include <unistd.h>
#include <vector>
#include <iterator>
#include <algorithm>
➜ rebar eunit -v
===> Failed creating providers. Run with DEBUG=1 for stacktrace.
oleg@x200:~/dev/gconfig (git: master) ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
➜ DEBUG=1 rebar eunit -v
===> error: function_clause [{lists,foldl,
[#Fun<dict.1.109136908>,
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.4 (abort with ^G)
1> c(my_class).
{ok,my_class}
2> A = my_class:new("A").
{my_class,{self,1,"A"}}
3> B = my_class:new("B").
{my_class,{self,1,"B"}}
4> A:version().
-module(my_class).
-export([new/1]).
-export([value/1]).
-export([version/1]).
-export([set_value/2]).
-record(self, {
version :: pos_integer(),
value :: string()
}).
config <- "\n"* line ("\n" line)* "\n"* `action(config, Node)`;
line <- ws* pair? ws* comment? ws* `action(line, Node)`;
pair <- key ws* "=" ws* value `action(pair, Node)`;
comment <- ";" [^\n]* `action(comment, Node)`;
key <- name ( "." name )* `action(key, Node)`;
value <- [^\n;]* `action(value, Node)`;
name <- [a-z] [a-z0-9_]* `action(name, Node)`;
ws <- [ \t\r]+ `action(whitespace, Node)`;
`
; some comment
a.b=1; some another comment
; a=2
#!/usr/bin/expect
spawn /usr/bin/rebar3 shell
expect "1> "
send "neotoma:file('gconfig_plain.peg').\r"
expect "2> "
send "compile:file('gconfig_plain.erl').\r"
expect "3> "
send "Result = gconfig_plain:parse().\r"
expect "4> "
send "Result.\r"
➜ ./test.expect
spawn /usr/bin/rebar3 shell
===> Verifying dependencies...
===> Compiling gconfig
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V6.4 (abort with ^G)
1> neotoma:file('gconfig_plain.peg').
ok
2> compile:file('gconfig_plain.erl').
package main
import (
"bufio"
"fmt"
"io"
"os"
"strings"
)