Skip to content

Instantly share code, notes, and snippets.

View aliostad's full-sized avatar
🐒
I may be slow to respond.

Ali Kheyrollahi aliostad

🐒
I may be slow to respond.
View GitHub Profile
@aliostad
aliostad / stockfish-interface.txt
Created August 17, 2019 10:41
stockfish - Description of the universal chess interface (UCI)
COPIED FROM https://build.opensuse.org/package/view_file/games/stockfish/stockfish-interface.txt?expand=1
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,
var url = "https://www.ilna.ir/fa/tiny/news-724227";
var client = new HttpClient();
var result = client.GetAsync(url).Result;
Console.WriteLine(result.StatusCode);
@aliostad
aliostad / tensorflow_ax+b=y.py
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
aliostad / upgrade_es_kib.sh
Created August 25, 2017 09:15
Rolling upgrade for Elasticsearch and Kibana
esversion="5.5.2"
kibversion="5.5.2"
username=<specify>
password=<specify>
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
aliostad / azure-data-centres-location-codes
Created June 18, 2017 15:53
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
aliostad / amazon_rotten_tomatoes_score.py
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 bs.select('ul li .s-item-container h2'):
name = a.text.replace('\t', ' ')
yearTags = a.parent.parent.select('> span.a-color-secondary')
@aliostad
aliostad / get-cluster-spark-external-ip.scala
Created June 10, 2017 11:28
How to get Spark Cluster's external IP for IP whitelisting
val client = new org.apache.http.impl.client.DefaultHttpClient()
val request = new org.apache.http.client.methods.HttpGet("http://ipinfo.io")
request.addHeader("accept", "application/json")
val response = client.execute(request)
val handler = new org.apache.http.impl.client.BasicResponseHandler()
println(handler.handleResponse(response).trim.toString)
@aliostad
aliostad / increase_file_desc.sh
Last active October 20, 2023 09:28
BASH script for increasing file descriptors on linux
MAXFILE=65536
CURRENT_MAXFILE=$(ulimit -n)
function update_sysctl(){
UPDT="fs.file-max = $MAXFILE"
if ! grep "$UPDT" /etc/sysctl.conf; then
echo "$UPDT" >> /etc/sysctl.conf
fi
}
@aliostad
aliostad / benchmark.cs
Created December 8, 2016 11:36
Linq OrderBy vs Array.Sort
class Program
{
static void Main(string[] args)
{
LinqVsArraySort();
}
static void LinqVsArraySort()
{
@aliostad
aliostad / ftpakamai.py
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 azure.storage.blob import BlobService
import time
_tmp_list = []
def _accept_file(x):
_tmp_list.append(x.split(' ')[-1])