Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Daniel Dugovic ddugovic

💭
I may be slow to respond.
View GitHub Profile
@ddugovic
ddugovic / nginx.conf.part
Last active Sep 19, 2020
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 / challengeUser.js
Created Apr 10, 2020
Create example for how to create a challenge using whiteAccessToken and blackAccessToken
View challengeUser.js
export async function challengeUser(
whiteAccessToken: string,
blackAccessToken: string,
username: string
): Promise<ChallengeGame> {
const response = await createClient(whiteAccessToken).post<
CreateChallengeResponse
>(
`/api/challenge/${username}`,
stringify({
@ddugovic
ddugovic / pipfilelock-to-requirements.sh
Created Jul 2, 2020
Generate requirements.txt from pipfile.lock
View pipfilelock-to-requirements.sh
#
# https://github.com/pypa/pipenv/issues/3493#issuecomment-651148507
cat Pipfile.lock \
| grep -B1 '"hashes"\|"version": ' \
| grep -v '"markers": \|"hashes": ' \
| grep ": {\|version" \
| sed -e 's/: {$//g' \
| tr '\n' ',' | tr -s ' ' ' ' \
| sed -e 's/, "version": "//g;s/", "/ /g;s/"//g;s/,//g' \
| tr ' ' '\n' \
View Lichess_Board_Resize.user.js
(function() {
function myzoom() {
document.body.setAttribute('style', '--zoom:140');
window.lichess.dispatchEvent(window, 'resize');
}
window.setInterval(myzoom, 1000);
})();
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 / 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