Skip to content

Instantly share code, notes, and snippets.

View 5HT's full-sized avatar
🌐
I'm very skeptical that person without empathy can create beautiful mathematics.

Namdak Tonpa 5HT

🌐
I'm very skeptical that person without empathy can create beautiful mathematics.
View GitHub Profile
@5HT
5HT / itoa.c
Created September 21, 2015 14:13
while(a)
{
a=a/10;
b =a;
}
if (b ==0)
str[i] ='0';
if (b ==1)
str[i] ='1';
> pb:test().
=INFO REPORT==== 8-Oct-2015::13:59:04 ===
pb:Retry 3: {call,<<"{\"a.speditRequest\":{\"reqMRef\":\"undefined\",\"reqMId\":\"undefined\",\"reqBank\":\"PB\"}}">>}
=INFO REPORT==== 8-Oct-2015::13:59:05 ===
pb:Retry 2: {call,<<"{\"a.speditRequest\":{\"reqMRef\":\"undefined\",\"reqMId\":\"undefined\",\"reqBank\":\"PB\"}}">>}
proc(init,#handler{state=State}=Async) ->
{ok,Async#handler{state= erlang:send_after(5000, erlang:self(), {renew})} };
proc({renew},#handler{state=Timer}=Async) ->
erlang:cancel_timer(Timer),
Now = calendar:local_time(),
Tok = case kvs:get(config,promin) of
{error,_} -> store(openSession([]),Now,Now);
{ok,#config{value=Prev}} -> case calendar:time_difference(Prev#token.issued, Now) of
{0,{0,M,_}} when M >= 25 -> store(openSession([]),Now,Now);
=ERROR REPORT==== 9-Nov-2015::19:55:30 ===
Error in process <0.663.0> on node '[email protected]' with exit value:
{function_clause,
[{services_bank,getFilteredCardList,
[[userCardsFrom,
{client_cards,undefined,undefined,undefined,undefined,undefined,
[{card,1,undefined,feed,undefined,undefined,undefined,[],
false,undefined,undefined,undefined,undefined,undefined,
undefined,0,undefined,<<"PB">>,<<"51682345678900">>,
undefined,<<"3">>,null,<<"51682345678900">>,<<"1">>,
@5HT
5HT / gist:700088dfe44f5ff56c91
Created November 16, 2015 21:03
Code Produced by Idris-Erlang
$ cat main.erl
%% -*- erlang -*-
%%! -smp enable -pa /Users/5HT/depot/5ht.co/idris-erlang/.cabal-sandbox/share/x86_64-osx-ghc-7.10.2/idris-erlang-0.0.2.0/irts
%% Generated by the Idris -> Erlang Compiler (idris-erlang).
-module(main).
-compile(inline). %% Enable Inlining
-compile({inline_size,1100}). %% Turn Inlining up to 11
-compile(export_all).
$ ./mad
MAD Container Tool version ad2a4d
invoke = mad params
params = [] | command [ options ] params
command = app | deps | clean | compile | up
| release [ beam | ling | script | runc
bash-3.2$ ./mad app sample
Create File: "sample/sys.config"
Create File: "sample/apps/sample/priv/static/spa/index.htm"
@5HT
5HT / fifo.c
Last active February 12, 2016 15:01
Automatic Verification of C Programs
$ cat queue.c
#include <stddef.h>
extern void *mallocN (int n);
extern void freeN(void *p, int n);
struct elem {
int a, b;
struct elem *next;
};
$ linja
[2/6] "/usr/local/Cellar/lean/0.2.0.20151013125924.gitd508ceccecf8504...clean" -i "/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.ilean"
FAILED: "/usr/local/Cellar/lean/0.2.0.20151013125924.gitd508ceccecf8504257b538de57d3c76ad1e20b35/bin/lean" /Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.lean -o "/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.olean" -c "/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.clean" -i "/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.ilean"
/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.lean:8:7: error: type mismatch at definition 'TypeEqu', has type
Type.{u+1} β†’ Type.{u+1} β†’ Type.{imax (u+2) (imax (u+2) u) (imax (u+2) (u+2) (u+2) u) (imax (u+2) (u+2) u) u}
but is expected to have type
Type.{u+1} β†’ Type.{u+1} β†’ Type.{u}
/Users/5HT/depot/groupoid/exe/prelude/lean/TypeEqu.lean:15:25: error: unknown identifier 'Setoid'
TypeEqu.{l_1} : Type.{l_1+1} β†’ Type.{l_1+1} β†’ Type.{l_1}
[2/6] "/usr/local/Cellar/lean/0.2.0.20151013125924.gitd508ceccecf8504...Mor.c
$ linja
[1/6] "/usr/local/Cellar/lean/0.2.0.20151115213912.gitdb59c6829c9f56c....clean" -i "/Users/5HT/depot/groupoid/exe/prelude/lean/Setoid.ilean"
structure SetoidType : Type.{l_1+1}
fields:
SetoidType.El : SetoidType.{l_1} β†’ Type.{l_1}
SetoidType.Equ : Ξ  (c : SetoidType.{l_1}), EquType.{l_1} (SetoidType.El.{l_1} c)
SetoidType.Refl : βˆ€ (c : SetoidType.{l_1}), Equ.ReflProp.{l_1} (SetoidType.Equ.{l_1} c)
SetoidType.Trans : βˆ€ (c : SetoidType.{l_1}), Equ.TransProp.{l_1} (SetoidType.Equ.{l_1} c)
SetoidType.Sym : βˆ€ (c : SetoidType.{l_1}), Equ.SymProp.{l_1} (SetoidType.Equ.{l_1} c)
[2/6] "/usr/local/Cellar/lean/0.2.0.20151115213912.gitdb59c6829c9f56c...Cat.clean" -i "/Users/5HT/depot/groupoid/exe/prelude/lean/Cat.ilean"
@5HT
5HT / redactor.js Commands
Last active March 2, 2016 05:57
redactor.js Commands
$ cat redactor.js | grep execCommand
document.execCommand('formatblock', false, '<' + tag + '>');
document.execCommand('outdent');
document.execCommand('formatblock', false, tag);
document.execCommand('enableObjectResizing', false, false);
document.execCommand('enableInlineTableEditing', false, false);
document.execCommand("AutoUrlDetect", false, false);
document.execCommand('indent');
document.execCommand('outdent');
document.execCommand('formatblock', false, 'p');