Skip to content

Instantly share code, notes, and snippets.

View lojikil's full-sized avatar
🌊
cantankerous and querulous, he was as the sea to the shore

Logyi, hajnalvédő lojikil

🌊
cantankerous and querulous, he was as the sea to the shore
View GitHub Profile
@lojikil
lojikil / gist:1131925
Created August 8, 2011 15:10
SRFI Bookmarklet
javascript:(function(){i=prompt("SRFI Number");window.location="http://srfi.schemers.org/srfi-"+i+"/srfi-"+i+".html";})()
/* compiler output */
SExp *member0_p (SExp *, SExp *);
SExp *
member0_p (SExp * x, SExp * l)
{
SExp *ret = nil, *x2 = nil, *l3 = nil;
int s1 = 1;
while (s1)
{
@lojikil
lojikil / micro-wget.pl
Created December 24, 2011 04:48
It is a long story, but I needed a quick and dirty wget-clone, enough to support `apt-cyg`, the Cygwin package downloader. one man page & 5 minutes
#!/usr/bin/env perl
# poor person's wget; enough to satisfy apt-cyg at least.
# works well enough to download OCaml via apt-cyg, so that's
# good enough for me.
use strict;
use LWP::Simple;
my($opt,$dest,$file,$rc);
; (hydra@eval '(if (< 3 4) "yes" "no") *tlenv*)
_ : Pair = '((3 4) (3 3) (9) (29 2) (3 "yes") (27 1) (3 "no"))
(load 3)
(load 4)
(<)
(compare-and-jump 2) ; jump 2 if false
(load "yes")
(jump 1)
(load "no")
book
book_key
title text
author_key
genre_join_key
author
author_key
author_name
procedure TClipper.IntersectEdges(e1,e2: PEdge;
const pt: TIntPoint; protects: TIntersectProtects = []);
procedure DoEdge1;
begin
AddOutPt(e1, e2, pt);
SwapSides(e1, e2);
SwapPolyIndexes(e1, e2);
end;
//----------------------------------------------------------------------
@lojikil
lojikil / load.ss
Created March 12, 2012 16:26
Hydra's load procedure
(define (hydra@load src-file)
"an implementation of the primitive procedure load"
(with f (open src-file :read)
(with-exception-handler
(fn (x) (display (format "An error occured while loading ~S: ~a\n" src-file x)) (close f))
(fn ()
(letrec ((loop (fn (expr)
(if (eq? expr #e)
#v
(begin
$ time ./run_hydra.ss hydra_s1.ss
55
6765
832040
2178309
real 0m0.830s
user 0m0.655s
sys 0m0.046s
@lojikil
lojikil / fnv.c
Created March 23, 2013 14:58
Fowler-Nolls-Vo hash implementations
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
uint64_t
fnv(char *key, uint32_t len)
{
uint64_t hash = 14695981039346656037;
uint32_t idx = 0;
for(; idx < len; idx++)
#include <stdio.h>
int
main(void) {
int i = 0, j = 5;
printf("%d, %d, %d\n", i, -~i, ~-i); // 0, 1, -1
printf("%d, %d, %d\n", j, -~j, ~-j); // 5, 6, 4
return 0;