Skip to content

Instantly share code, notes, and snippets.

@metaxy
metaxy / gist:648823
Created October 27, 2010 10:51
B-Baum
-- http://www.haskell.org/pipermail/haskell-cafe/2005-November/012009.html only def
data BTree = BTree [Int] [BTree] deriving (Show, Eq)
t = 2 -- t ist die minimale anzahl an kindknoten
if' :: Bool -> a -> a -> a
if' True x _ = x
if' False _ y = y
isLeaf (BTree x y) = length y == 0
@hippietrail
hippietrail / stripgutenberg.pl
Created December 22, 2010 18:59
Strip headers/footers from Project Gutenberg texts
#!/usr/bin/perl
# stripgutenberg.pl < in.txt > out.txt
#
# designed for piping
# Written by Andrew Dunbar (hippietrail), released into the public domain, Dec 2010
use strict;
my $debug = 0;
@metaxy
metaxy / quine.hs
Created October 21, 2011 11:59
Quine McCluskey
import List
import Maybe
type Var = (Int, Bool)
type Minterm = [Var]
type Tabelle = [Zelle]
type Zelle = (Minterm,[Int])
type Table a b = [[(a,b)]]
data In a = W | F | N
instance Show a => Show (In a) where
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@JulienPalard
JulienPalard / curry.py
Created August 1, 2014 10:51
KISS Python curry
#!/usr/bin/env python
def curry(func):
"""
Decorator to curry a function, typical usage:
>>> @curry
... def foo(a, b, c):
... return a + b + c
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`