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
@mdstoy
mdstoy / get-kifu
Created January 12, 2018 15:23
(Lazy) One liner that create csa file from shogi wars kifu url
curl <kifu-url> | grep receiveMove | sed -E 's/( +receiveMove\("|[A-Z_]+"\);|,L[0-9]+)//g' | sed 's/^/PI\t+\t/' | sed 's/\t/\n/g' > [output-file]
@andreij
andreij / pubapi_docs.html
Last active May 10, 2022 15:59 — forked from BiviaBen/pubapi_docs.html
Chess.com Published-Data API
<p>The PubAPI is a read-only REST API that responds with JSON-LD data. Our goal is to re-package all currently public data from the website and make it available via the PubAPI. "Public Data" is information available to people who are not logged in, such as player data, game data, and club/tournament information. This excludes private information that is restricted to the logged in user, such as game chat and conditional moves.</p>
<p>This is read-only data. You cannot send game-moves or other commands to Chess.com from this system. If you wish to send commands, you will be interested in the Interactive API releasing later this year.</p>
<p>To use the PubAPI:</p>
<ol>
<li>determine the data you want, and compose the URL for it based on the endpoint URL pattern</li>
<li>request that URL in your browser, program, <a href="https://www.getpostman.com/">Postman</a>, cURL, or <a href="https://en.wikipedia.org/wiki/IP_over_Avian_Carriers">pigeon</a>.</li>
<li>enjoy the JSON <img src="https://www.chess.com/bundles/we
# 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;
@EvanHahn
EvanHahn / gist:2587465
Last active October 9, 2023 01:26
Caesar shift in JavaScript
/*
JavaScript Caesar shift
by Evan Hahn (evanhahn.com)
"Encrypt" like this:
caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!"
And "decrypt" like this:
@ornicar
ornicar / browser-ndjson-stream-reader.js
Last active November 9, 2023 19:02
Read a ND-JSON stream from the browser or from nodejs
/* FOR THE BROWSER
Utility function to read a ND-JSON HTTP stream.
`processLine` is a function taking a JSON object. It will be called with each element of the stream.
`response` is the result of a `fetch` request.
See usage example in the next file.
*/
const readStream = processLine => response => {
const stream = response.body.getReader();
const matcher = /\r?\n/;
@DerEnderKeks
DerEnderKeks / WebhookTutorial.md
Last active December 4, 2023 20:28
Simple Webhook Tutorial (Twitter -> Discord using IFTTT)

Simple Webhook Tutorial

In this tutorial, I will be explaining how to set up a simple webhook to relay your tweets to a Discord channel.

Step 1 - Register on IFTTT

  1. Go to https://ifttt.com/ and create an account (if you don't already have one).

Step 2 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send Tweets.

  2. In the settings for that channel, find the Webhooks option and create a new webhook.

@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.
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.
@Marken-Foo
Marken-Foo / KIF_standard.md
Created December 19, 2020 14:18
Shogi KIF file standard

Kifu file KIF format

This document is a translation of the original Japanese text at http://kakinoki.o.oo7.jp/kif_format.html on 2020-11-11 by Marken Foo.

  • 2020/11/11 translated to English
  • 2020/11/25 added translated tsumeshogi sample headers

Summary

The KIF file format used by programs like Kakinoki Shogi and "Kifu for Series" is a text file format described below.

@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing