Skip to content

Instantly share code, notes, and snippets.

View Leonidas-from-XIV's full-sized avatar

Marek Kubica Leonidas-from-XIV

View GitHub Profile
Builder := Object clone
Builder indentLevel := 0
Builder indentString := " "
Builder forward := method(
write(indentString * indentLevel, "<", call message name)
indentLevel = indentLevel + 1
call message arguments foreach(index, arg,
content := self doMessage(arg)
if(index == 0,
if(content type == "Map",
@Leonidas-from-XIV
Leonidas-from-XIV / listsyntax.io
Created December 6, 2012 21:44
Python-style list literals for Io
squareBrackets := method(
l := List clone
call message arguments foreach(arg,
l append(doMessage(arg))))
[1, 2, 3, 3+1] println
@Leonidas-from-XIV
Leonidas-from-XIV / Xorg.0.log
Created December 15, 2012 16:40
Xorg failure on SandyBridge GPU
[ 28.161]
This is a pre-release version of the X server from The X.Org Foundation.
It is not supported in any way.
Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.
Select the "xorg" product for bugs you find in this release.
Before reporting bugs in pre-release versions please check the
latest version in the X.Org Foundation git repository.
See http://wiki.x.org/wiki/GitPage for git access instructions.
[ 28.161]
X.Org X Server 1.13.0.902 (1.13.1 RC 2)
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
Identifier "evdev pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
@Leonidas-from-XIV
Leonidas-from-XIV / _oasis
Created December 19, 2012 18:00
ocambuild does not find anything in Archive_stubs.c
Library "ost"
Path: src/
Modules: Archive
CSources: Archive_stubs.c
CCLib: -larchive
BuildTools: ocamlbuild
Executable "ost-launch"
Path: src
BuildTools: ocamlbuild
@Leonidas-from-XIV
Leonidas-from-XIV / gist:4338956
Created December 19, 2012 18:14
OCamlbuilding with classic-display
% ocamlbuild -classic-display src/libost_stubs.a src/dllost_stubs.so src/ost.cma src/ost.cmxa src/ost.a src/ost.cmxs src/launch.native -tag debug
/usr/bin/ocamlopt.opt -I /usr/lib/ocaml/ocamlbuild unix.cmxa /usr/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /usr/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
findlib: [WARNING] cannot read directory /usr/lib/ocaml/site-lib: No such file or directory
ocamlfind ocamlc -c src/Archive_stubs.c
mv Archive_stubs.o src/Archive_stubs.o
/usr/bin/ocamlmklib -o src/ost_stubs -larchive src/Archive_stubs.o
ocamlfind ocamldep -modules src/Archive.ml > src/Archive.ml.depends
ocamlfind ocamlc -c -g -I src -o src/Archive.cmo src/Archive.ml
ocamlfind ocamlc -a -dllib -lost_stubs -cclib -lost_stubs -cclib -larchive src/Archive.cmo -o src/ost.cma
ocamlfind ocamlopt -c -g -I src -o src/Archive.cmx src/Archive.ml
@Leonidas-from-XIV
Leonidas-from-XIV / gist:4585246
Created January 21, 2013 10:54
Mergesort in Prolog
splitlist(L, [], L, 0).
splitlist([H|T], [H|A], B, N) :- Nminus1 is N-1, splitlist(T, A, B, Nminus1).
halfhalf(L, A, B) :- length(L, Len), Half is Len//2, splitlist(L, A, B, Half).
merge(A, [], A).
merge([], B, B).
merge([Ha|Ta], [Hb|Tb], R) :- Ha =< Hb, merge(Ta, [Hb|Tb], M), R = [Ha|M].
merge([Ha|Ta], [Hb|Tb], R) :- Ha > Hb, merge(Tb, [Ha|Ta], M), R = [Hb|M].
val src = Source.fromFile("censor.json").mkString
val loaded = JSON.parseFull(src)
val parsed = loaded match {
case Some(e: Map[String, Any]) => e
case None => Map()
}
module Main where
allEven [] = []
allEven (h:t) = if even h then h:allEven t else allEven t
allEven1 = filter even
allEven2 = foldl (\acc item -> if even item then item:acc else acc) []
allEven3 xs = [x | x <- xs, even x]
@Leonidas-from-XIV
Leonidas-from-XIV / gist:4969262
Created February 16, 2013 23:48
libarchive crash in free
*** Error in `bin/libarchive_test': double free or corruption (top): 0x00000000055e0350 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x7ab06)[0x7feb31e7db06]
/usr/lib/libc.so.6(+0x7b883)[0x7feb31e7e883]
bin/libarchive_test[0x4ef4cb]
bin/libarchive_test(test_write_format_raw+0x351)[0x4d3f71]
bin/libarchive_test(main+0x779)[0x412339]
/usr/lib/libc.so.6(__libc_start_main+0xf5)[0x7feb31e24a15]
bin/libarchive_test[0x412df9]
======= Memory map: ========