Skip to content

Instantly share code, notes, and snippets.


Jan Stępień jstepien

View GitHub Profile
jstepien / Cargo.toml
Last active Dec 1, 2019
It All Looks the Same to Me
View Cargo.toml
name = "bk"
version = "0.1.0"
authors = ["Jan Stępień"]
jstepien / Cargo.toml
Created Feb 5, 2018
That looks oddly familiar
View Cargo.toml
name = "phash"
version = "0.1.0"
authors = ["Jan Stępień"]
libc = "0.2.36"
rayon = "0.9.0"
jstepien / reduce-and-gc.clj
Last active Mar 6, 2017
View reduce-and-gc.clj
;; Let's experiment with Clojure 1.8.0 running with a relatively small heap
;; of 10MB. To avoid any extra dependencies, we'll start it as follows:
;; java -Xmx10m -jar clojure-1.8.0.jar
;; Copy following expressions into your REPL one by one.
;; Let's take a small number, for instance one million.
(def small-num (* 1000 1000))
jstepien / 0001-Don-t-assume-that-llvm-config-is-a-Perl-script.patch
Created May 3, 2012
[PATCH] Don't assume that llvm-config is a Perl script
View 0001-Don-t-assume-that-llvm-config-is-a-Perl-script.patch
As of the upcoming LLVM 3.1 release llvm-config has been rewritten as a
native executable [1]. Executing it with Perl causes the configure script
to fail with a message
Unrecognized character \x7F; marked by <-- HERE after
<-- HERE near column 1 at llvm-config line 1.
This commit makes llvm-config to be invoked directly. As a result it works
correctly with LLVM 3.0 and fails with a more friendly error message when
encountering LLVM 3.1svn.
View Makefile
CFLAGS = $(shell pkg-config --cflags mozjs185) -O2 -Wall
LDFLAGS = -Wl,--as-needed -Wl,-O1
LDLIBS = $(shell pkg-config --libs mozjs185)
all: parse
parse: parse.o
parse.o: parse.c date.js.h
date.js.h: date.js
( \
echo 'const char *code =' ; \
jstepien / cartesian.rb
Created Apr 7, 2011
A recursive approach to the Cartesian product
View cartesian.rb
# irb(main):001:0> cartprod [[:a, :b], (1..3), [true, false]]
# => [[:a, 1, true], [:a, 1, false], [:a, 2, true], [:a, 2, false],
# [:a, 3, true], [:a, 3, false], [:b, 1, true], [:b, 1, false],
# [:b, 2, true], [:b, 2, false], [:b, 3, true], [:b, 3, false]]
def cartprod(colls)
if colls.empty?
rest_cartprod = cartprod colls[1..-1]
colls[0].reduce [] do |all, x|
jstepien / ax_check_gems.m4
Created Nov 11, 2010
An M4 macro checking for given gems. Example: AX_CHECK_GEMS([rspec simplecov])
View ax_check_gems.m4
AC_MSG_CHECKING([whether we've got all required gems])
result=`$RUBY -e '
ARGV.each { |f| begin; require f; rescue LoadError; puts(f); exit 1; end }
' $1 2>&1`
if test x = "x$result"; then
AC_MSG_ERROR([cannot find $result])
jstepien /
Created Oct 7, 2010
Prints file's history ready for inclusion in LaTeX documents
#!/usr/bin/env perl
use warnings;
use strict;
use Git;
use File::Basename;
use Date::Parse;
use Date::Format;
# States
jstepien /
Created Jul 2, 2010
A script creating a static dump of a Trac instance
set -x
jstepien / slides.tex
Created Apr 25, 2010
A LaTeX file for extracting slides from handouts
View slides.tex
n=9;for i in `seq $n`; do pages=$(identify wyklad$i.pdf | tail -n 1 | perl -ne '/^wyklad.*?\[(\d+)/; $_ = $1+1; print'); sed -e s/wyklad1/wyklad$i/g -e s/23/$pages/ < slides.tex > slides$i.tex; done