Skip to content

Instantly share code, notes, and snippets.

View jskripsky's full-sized avatar

Juraj Skripsky jskripsky

  • Zurich, Switzerland
View GitHub Profile
// https://doc.rust-lang.org/std/prelude/index.html
// https://docs.rs/num-complex/0.2.3/num_complex/struct.Complex.html
// https://docs.rs/rayon/1.2.0/rayon/prelude/index.html
use num::Complex;
use rayon::prelude::*;
/// Try to determine if `c` is in the Mandelbrot set, using at most `limit`
/// iterations to decide.
///
@jskripsky
jskripsky / 15-puzzle.pl
Last active March 5, 2019 11:57
15 puzzle solver written in Prolog
:- use_rendering(table).
next_to(X, Y) :- Y is X+1.
next_to(X, Y) :- Y is X-1.
neighbor(X, Y1, X, Y2) :- next_to(Y1, Y2).
neighbor(X1, Y, X2, Y) :- next_to(X1, X2).
tile(B, X, Y, N) :-
nth0(Y, B, R),
nth0(X, R, N).
@jskripsky
jskripsky / fsc-bug.fs
Last active February 10, 2019 20:46
F# compiler bug: attributes on type aliases are silently ignored.
open System
[<AttributeUsage(AttributeTargets.Class)>]
type DocAttribute (text: string) =
inherit Attribute()
member x.Text = text
[<Doc "Attribute on Test">]
type Test = {
i: int
#r "WebDriver.dll"
open OpenQA.Selenium
open OpenQA.Selenium.Firefox
open OpenQA.Selenium.Chrome
use driver = new FirefoxDriver ()
let nav = driver.Navigate ()
nav.GoToUrl "http://www.hsr.ch/"
@jskripsky
jskripsky / gist:6262759
Created August 18, 2013 17:10
Hetzner EX40 hardware
Hardware data:
CPU1 Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (Cores 8)
RAM 32060 MB
Disk /dev/sdb: 2000.4 GB (=> 1907 GIB)
Disk /dev/sda: 2000.4 GB (=> 1907 GIB)
Network data:
eth0 LINK: yes
MAC: d4:3d:7e:be:db:06
@jskripsky
jskripsky / gist:6224523
Created August 13, 2013 19:02
schuler zoom pic clean-up
[root@schuler generated]# for d in `find -maxdepth 1 -type d | grep -v "\.$"`; do echo "rm -rf $d"; done | wc
6672 20016 153456
[root@schuler generated]# ls *.xml | wc
6672 6672 120096
[root@schuler generated]# rm *.xml -f
[root@schuler generated]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mercury-lv_root
75G 69G 5.1G 94% /
/dev/vda1 194M 30M 155M 17% /boot
@jskripsky
jskripsky / modify.ldif
Created October 22, 2012 18:39
Modify existing LDAP entries with LDIF
dn: dc=zublin.ch,ou=hosting,o=hotfeet.ch
changetype: modify
add: associatedDomain
associatedDomain: zublin.it
-
add: associatedDomain
associatedDomain: zueblin.it
@jskripsky
jskripsky / dumptypes.sh
Created August 15, 2012 06:34
Dump type descriptions for given dll
#!/bin/bash
for type in $(monop -r:HotFeet.SCM.DB.dll | grep "$HotFeet\.SCM\.DB\."); do monop -d -r:HotFeet.SCM.DB.dll $type >/tmp/scm/$(echo $type | cut -c 16-).cs; done
@jskripsky
jskripsky / remove-trailing-whitespace.sh
Created August 5, 2012 15:36
Remove trailing whitespace.
#!/bin/bash
sed -i 's/[ \t]*$//'
@jskripsky
jskripsky / etc-bash_completion.d-git
Created July 24, 2012 22:49
Ignore nfs dirs in git-aware prompt (patch)
[...]
__gitdir ()
{
if [ "$(stat -f -c %T .)" = "nfs" ]; then
echo "$1"
elif [ -z "${1-}" ]; then
[...]