Skip to content

Instantly share code, notes, and snippets.

View ddugovic's full-sized avatar
💭
I may be slow to respond.

Daniel Dugovic ddugovic

💭
I may be slow to respond.
View GitHub Profile
@mathieuancelin
mathieuancelin / GoodOldPlayframework.scala
Last active April 28, 2019 19:06
A really dirty way to use Playframework without Guice
package old.play
import java.sql.Connection
import java.util.concurrent.atomic.{AtomicInteger, AtomicReference}
import java.util.concurrent.{Executors, ThreadFactory}
import akka.actor.{ActorSystem, Scheduler}
import akka.stream.Materializer
import play.api.ApplicationLoader.Context
import play.api.Mode.Mode
# Simple SonarQube database and user creation for Postgresql
#
sudo -u postgres psql postgres
CREATE DATABASE sonar;
CREATE USER sonar WITH PASSWORD 'verysecret';
GRANT ALL PRIVILEGES ON DATABASE sonar TO sonar;
@ornicar
ornicar / lichess.proxy.conf
Last active July 16, 2021 07:08
Set up a lichess proxy to bypass firewalls and play chess at school/work
# /etc/nginx/sites-enabled/lichess.proxy.conf
# Replace "lichess.scalex.org" by your own domain.
# Note: This only works for the "en" subdomain.
server {
listen 80;
server_name socket.en.lichess.scalex.org;
location / {
proxy_set_header Host socket.en.lichess.org;
proxy_http_version 1.1;
@niklasf
niklasf / fuzz-engine.py
Last active September 17, 2015 03:49
Fuzz testing for UCI engines
#!/usr/bin/python3
# Fuzz testing for UCI engines using python-chess.
import chess
import chess.uci
import random
import logging
import sys
random.seed(123456)
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@niklasf
niklasf / bratko-kopec.py
Last active February 24, 2020 15:37
An implementation of the Bratko-Kopec Test using python-chess
#!/usr/bin/python
import chess
import chess.uci
import sys
import time
MOVETIME = 120.0

Lichess games CSV export

This is a direct export from lichess database. Some fields are binary encoded.

Head

_id,so,s,v,if,us,p0.ai,p0.e,p1.ai,p1.e,c,mt,w,an,ra,pg,ca
"04tbfylw",1,33,,,"[ ""miroslavm970"", ""redlightning530"" ]",,1480,,1072,0500000884000B930000000000,4665B5,true,,true,23242B55806A801C6140,2013-11-14T07:59:10.945Z
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
anonymous
anonymous / fish.py
Created August 30, 2013 17:41
><> python interpreter.
#!/usr/local/bin/python3.2
"""
Python interpreter for the esoteric language ><> (pronounced /ˈfɪʃ/).
Usage: ./fish.py --help
More information: http://esolangs.org/wiki/Fish
Requires python 2.7/3.2 or higher.
@yanatan16
yanatan16 / spsa.py
Last active March 15, 2024 19:05
Simultaneous Perturbation Stochastic Approximation code in python
'''
Simultaneous Perturbation Stochastic Approximation
Author: Jon Eisen
License: MIT
This code defines runs SPSA using iterators.
A quick intro to iterators:
Iterators are like arrays except that we don't store the whole array, we just
store how to get to the next element. In this way, we can create infinite
iterators. In python, iterators can act very similar to arrays.