Skip to content

Instantly share code, notes, and snippets.

{
"meta": {
"version": "v1.0.0",
"canonical": "https://github.com/jsonresume/resume-schema/blob/v1.0.0/schema.json"
},
"basics": {
"name": "Arash Behmand",
"label": "Data Scientist",
"email": "[email protected]",
"phone": "(+44) 759 3359 776",
@arashbehmand
arashbehmand / willson.py
Last active May 15, 2020 18:38
[willson score] don't sort by average rating - willson score with and without continuity correction
# https://www.evanmiller.org/how-not-to-sort-by-average-rating.html
# https://stackoverflow.com/questions/1411199/what-is-a-better-way-to-sort-by-a-5-star-rating
from math import sqrt
import scipy.stats as st
def wilson_score_lbound(phat, n, za2):
if n == 0:
return 0
@arashbehmand
arashbehmand / snippet.py
Created May 7, 2020 14:41
df to xlsx #pyspark #zeppelin
import io
mem_buf = io.BytesIO()
pdf = df.toPandas()
pdf.to_excel(mem_buf)
gen_link(mem_buf.getvalue(), "sample.xlsx")
@arashbehmand
arashbehmand / u.py
Created March 29, 2020 10:49
[unpersist everything] #pyspark
for (id, rdd) in sc._jsc.getPersistentRDDs().items():
rdd.unpersist()
print("Unpersisted {} rdd".format(id))
spark.catalog.clearCache()
@arashbehmand
arashbehmand / s.py
Created March 29, 2020 08:22
[spark-df-profiling] #pyspark
%pyspark
# PersonalPip.install("spark-df-profiling")
# PersonalPip.install('pandas==0.25.1',upgrade=True)
import spark_df_profiling
import io
import tempfile
profile = spark_df_profiling.ProfileReport(df)
mem_buf = io.BytesIO()
print('%html')
with tempfile.NamedTemporaryFile() as tmp:
@arashbehmand
arashbehmand / snippet.js
Last active March 11, 2020 11:19
set font size for all zeppelin paragraphs #Zeppelin
$(".ng-scope .paragraph").each(function(){
var S = angular.element($(this)).scope()
S.changeFontSize(S.paragraph,12);
S.showLineNumbers(S.paragraph);
});
@arashbehmand
arashbehmand / web-servers.md
Created June 23, 2019 09:16 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@arashbehmand
arashbehmand / console.js
Last active July 22, 2020 11:22
jquery to select all faradars courses from email
$('a.fonttools-rtl').filter(function(){return $(this).text().includes('دانلود')}).each(function(){console.log($(this).attr('href'))})
$('div.margin-div-link>A').filter(function(){return $(this).text().includes('دانلود')}).map(function(){return $(this).attr('href')}).toArray().join('\n')