Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Ali Kheyrollahi aliostad

I may be slow to respond.
View GitHub Profile
aliostad / stockfish-interface.txt
Created August 17, 2019 10:41
stockfish - Description of the universal chess interface (UCI)
View stockfish-interface.txt
Description of the universal chess interface (UCI) April 2006
* The specification is independent of the operating system. For Windows,
the engine is a normal exe file, either a console or "real" windows application.
* all communication is done via standard input and output with text commands,
View dotnet-core-location-header-bug.cs
var url = "";
var client = new HttpClient();
var result = client.GetAsync(url).Result;
aliostad /
Created December 2, 2018 19:32
Solving simple linear function using tensorflow
import keras
import tensorflow as tf
import keras.backend as K
import numpy as np
from tensorflow.contrib.layers import *
# What we want to do: aX + b = Y
''' This one is using without using feed
X = np.random.uniform(-100., 100., 1000)
aliostad /
Created August 25, 2017 09:15
Rolling upgrade for Elasticsearch and Kibana
nodecount=4 #change
oldesv=$(dpkg -s elasticsearch 2>/dev/null | grep Version | cut -f2 -d' ')
oldkibv=$(dpkg -s kibana 2>/dev/null | grep Version | cut -f2 -d' ')
aliostad / azure-data-centres-location-codes
Created June 18, 2017 15:53
Azure Data Centres - Location Codes
View azure-data-centres-location-codes
"value": [
"id": "/subscriptions/c3dfd792-49a4-4b06-80fc-6fc6d06c4742/locations/eastasia",
"name": "eastasia",
"displayName": "East Asia",
"longitude": "114.188",
"latitude": "22.267"
aliostad /
Created June 13, 2017 08:14
A simple script to find Amazon prime (UK) films and their rotten tomato score
from bs4 import BeautifulSoup
import codecs
import requests
def get_film_names(doc):
res = []
bs = BeautifulSoup(doc, 'html.parser')
for a in'ul li .s-item-container h2'):
name = a.text.replace('\t', ' ')
yearTags ='> span.a-color-secondary')
aliostad / get-cluster-spark-external-ip.scala
Created June 10, 2017 11:28
How to get Spark Cluster's external IP for IP whitelisting
View get-cluster-spark-external-ip.scala
val client = new org.apache.http.impl.client.DefaultHttpClient()
val request = new org.apache.http.client.methods.HttpGet("")
request.addHeader("accept", "application/json")
val response = client.execute(request)
val handler = new org.apache.http.impl.client.BasicResponseHandler()
aliostad /
Last active May 8, 2017 14:20
BASH script for increasing file descriptors on linux
CURRENT_MAXFILE=$(ulimit -n)
function update_sysctl(){
UPDT="fs.file-max = $MAXFILE"
if ! grep "$UPDT" /etc/sysctl.conf; then
echo "$UPDT" >> /etc/sysctl.conf
aliostad / benchmark.cs
Created December 8, 2016 11:36
Linq OrderBy vs Array.Sort
View benchmark.cs
class Program
static void Main(string[] args)
static void LinqVsArraySort()
aliostad /
Last active August 22, 2016 11:09
A python script to download Akamai log files from FTP drop folder to an Azure blob storage
from ftplib import FTP
import sys
import os
from import BlobService
import time
_tmp_list = []
def _accept_file(x):
_tmp_list.append(x.split(' ')[-1])