Skip to content

Instantly share code, notes, and snippets.

Daniel Dugovic ddugovic

Block or report user

Report or block ddugovic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:64b7638338fa7d366b22e113ed9669b3
function play(min,sec){var challenges=$(".challenge");if(arguments.length===0)return challenges.eq(Math.floor(Math.random()*challenges.length)).find(".accept").click();else{challenges=challenges.filter(function(){return $(this).find(".desc").text().search(new RegExp(min+"\\+"+sec))!==-1});if(challenges.length===0)console.log("No challenges matching the specified time control");else{return challenges.eq(Math.floor(Math.random()*challenges.length)).find(".accept").click()}}}
@ddugovic
ddugovic / nginx.conf.part
Created Dec 25, 2018
Part of my nginx configuration
View nginx.conf.part
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
server_name dugovic.mooo.com;
listen 80;
@ddugovic
ddugovic / stockfish.js
Created Jun 14, 2018
Relay Chess Stockfish.js
View stockfish.js
This file has been truncated, but you can view the full file.
var Module = {
print: (function(stdout) {
postMessage(stdout)
})
};
var Module;
if (!Module) Module = (typeof Module !== "undefined" ? Module : null) || {};
var moduleOverrides = {};
for (var key in Module) {
@ddugovic
ddugovic / sl.sh
Created Mar 11, 2018
Stream Loading...
View sl.sh
#!/bin/bash
x=1
clear
while [ $? -eq 0 ]
do
x=$(( $x + 1 ))
/home/lila/sl/sl -dew -$x
done
clear && fortune | cowsay
View chess_game_analyzer_v39.14.beta.py
# -*- coding: utf-8 -*-
"""
I. About the script
1. It takes a pgn file with games in it and analyze those
games there one by one if there are more than one game
2. It mainly uses Stockfish uci engine during development.
Other uci engines can be used provided those engines support
multipv mode
@ddugovic
ddugovic / test-epd.py
Last active Nov 24, 2017 — forked from niklasf/bratko-kopec.py
An implementation of the Bratko-Kopec Test using python-chess
View test-epd.py
#!/usr/bin/python
import chess
import chess.uci
import sys
import time
def test_epd(engine, epd):
position = chess.Board()
View E4_Best_by_Test.user.js
// ==UserScript==
// @name E4, Best by Test
// @namespace https://github.com/ddugovic/UserScripts
// @description Best by test!
// @author ddugovic
// @copyright 2017+, ddugovic
// @license CC0 1.0 Universal
// @match https://lichess.org/training/coordinate
// @require https://lichess1.org/assets/compiled/coordinate.js?v=1932
// @grant none
@ddugovic
ddugovic / crazyhouse-puzzles-test.epd
Last active Aug 27, 2017
Crazyhouse test positions
View crazyhouse-puzzles-test.epd
% Crazyhouse variant testsuite from https://chessvariants.training/
r6k/pppq2pp/3pp3/4p3/3nP1BP/2NPK1P1/PPP5/3R4[RBBNNPqrb] b - - bm B@f4+
rnb2r2/ppp3p1/4kp2/4pp1Q/3P4/8/PPP2PPP/R1B1KBNR[QBPPnn] w KQ - bm Bc4+ B@d5+
rnbk4/ppp1bp1p/8/4P3/4p3/2N5/PPP2PPP/R1B1KBNR[QRNPPqp] w KQ - bm Q@h8+ Q@g8+
r7/p1p1b1rp/b3kn2/4p1P1/3pP1n1/2NP2P1/PPP2pKP/R1BQ3R[QNPPb] w - - bm Q@d5+
r1b4r/p5pp/2pkp3/3p4/3Pp3/8/P1P2PPP/R2n1RK1[QBNNqbbnppp] w - - bm B@c5+ B@b4+
r3nr1b/ppp2p1k/6p1/4P1qB/3PK3/4Q3/PPP3PP/R7[RBBNNPPnpp] b - - bm Qf5+
r4r1k/ppp2pp1/3N4/3Np3/B5p1/6B1/PP3Pp1/R1BQ1RK1[QNPPPbnpp] w - - bm Q@h6+
1r5k/1P2Q1p1/p3Qnb1/1pp3N1/8/2P1BPp1/PP4P1/R4R1K[BBNrnppppp] w - - bm N@f7+
1rRq1r2/1PppkpQp/p3bN2/1pb1pp2/4P3/2P4N/PP4PP/Rb5K[BNnp] w - - bm Rxd8
@ddugovic
ddugovic / pawn_encoder.rb
Last active Jun 13, 2017
Encode white pawns and black pawns into bitmasks
View pawn_encoder.rb
# Program to encode pawns as bitmasks from a FEN
# Usage: ruby pawn_encoder.rb "rn3rk1/4bpp1/pq2bn1p/2pp4/B6B/2N1PN2/PP3PPP/2RQ1RK1"
def encode(fen)
board = fen.gsub("8"," 7").gsub("7"," 6").gsub("6"," 5").gsub("5"," 4").gsub("4"," 3").gsub("3"," 2").gsub("2"," 1").gsub("1"," ")
wpawnsA = board.gsub(/[^P\/]/,"0").gsub(/P/,"1").split("/")
bpawnsA = board.gsub(/[^p\/]/,"0").gsub(/p/,"1").split("/")
wpawnsB = wpawnsA.rotate
bpawnsB = bpawnsA.rotate(-1)
@ddugovic
ddugovic / run.pl
Last active Nov 7, 2016
Disclaimer: this generates some redundant files and puts files in the . directory unless specified otherwise
View run.pl
#!/usr/bin/perl
$ENV{'STBWDIR'} = '.';
$ENV{'STBZDIR'} = '.';
$ENV{'STBSTATSDIR'} = '.';
$ENV{'LTBWDIR'} = '.';
$ENV{'LTBZDIR'} = '.';
$ENV{'LTBSTATSDIR'} = '.';
$ENV{'GTBWDIR'} = '.';
$ENV{'GTBZDIR'} = '.';
You can’t perform that action at this time.