Skip to content

Instantly share code, notes, and snippets.

View xjcl's full-sized avatar
👋
Say hi to me!

Jan-Frederik Konopka xjcl

👋
Say hi to me!
  • Düsseldorf, Germany
View GitHub Profile
@erikhuizinga
erikhuizinga / CartesianProduct.kt
Last active August 14, 2023 08:24
Kotlin function for cartesian product of any number of sets of any size
import kotlin.reflect.KFunction
typealias CartesianProduct = Set<List<*>>
/**
* Create the cartesian product of any number of sets of any size. Useful for parameterized tests
* to generate a large parameter space with little code. Note that any type information is lost, as
* the returned set contains list of any combination of types in the input set.
*
* @param a The first set.
@syllog1sm
syllog1sm / gist:10343947
Last active November 7, 2023 13:09
A simple Python dependency parser
"""A simple implementation of a greedy transition-based parser. Released under BSD license."""
from os import path
import os
import sys
from collections import defaultdict
import random
import time
import pickle
SHIFT = 0; RIGHT = 1; LEFT = 2;
@justecorruptio
justecorruptio / 2048.py
Last active September 22, 2017 05:17
Tiny 2048
import os,tty;tty.setcbreak(0);M=['']*16
def G(v):
p=['']*4;u=list(filter(str,v));i=3
while u:z=u.pop();p[i]=u and z==u[-1]and 2*u.pop()or z;i-=1
return p
def Y(M,k):i=1;M=zip(*[iter(M)]*4);exec'M=map([list,G][i*k==k*k],zip(*M))[::-1];i+=1;'*4;return sum(M,[])
while 1:
r=id(M)%71+17
while M[r%16]*r:r-=1
if r:M[r%16]=r%7%2*2+2
@shsteimer
shsteimer / gist:7257245
Created October 31, 2013 21:10
Tip to delete tags by pattern
#delete all the remote tags with the pattern your looking for, ie. DEV-
git tag | grep <pattern> | xargs -n 1 -i% git push origin :refs/tags/%
#delete all your local tags
git tag | xargs -n 1 -i% git tag -d %
#fetch the remote tags which still remain
git fetch
@robotslave
robotslave / gist:4633393
Last active February 6, 2021 12:22
How to get Emoji in your Ubuntu Terminal
<!--
1. Download the Android Jelly Bean fonts and the Symbola font:
https://www.dropbox.com/s/tvtzcnzkvbe0nrt/jelly-bean-fonts.zip
http://users.teilar.gr/~g1951d/Symbola707.zip
2. unzip the files and put AndroidEmoji.ttf and Symbola.ttf (and any of the other fonts that strike your fancy)
in your ~/.fonts/ directory
3. run `fc-cache -f`. You can check to make sure the new fonts
were installed with `fc-list`. You'll probably want to grep the copious output for Symbola or Emoji
@rasher
rasher / flairstats.py
Created December 4, 2012 20:47
Subreddit flair stats
#!/usr/bin/env python
import sys
from datetime import datetime
from praw import Reddit
user = 'rasherdk'
password = 'PASSWORDGOESHERE'
srname = 'nfl'
r = Reddit('flairstats/0.1')