Skip to content

Instantly share code, notes, and snippets.

Focusing on Information Retrieval, Search, Personalization and Data ETLs.

Sep Dehpour seperman

Focusing on Information Retrieval, Search, Personalization and Data ETLs.
View GitHub Profile
nirizr /
Last active Dec 22, 2020
sqlalchemy upsert supporting delayed ORM insertion and duplicate removal (inside a single query)
def upsert(session, model, rows):
table = model.__table__
stmt = postgresql.insert(table)
primary_keys = [ for key in inspect(table).primary_key]
update_dict = { c for c in stmt.excluded if not c.primary_key}
if not update_dict:
raise ValueError("insert_or_update resulted in an empty update_dict")
stmt = stmt.on_conflict_do_update(index_elements=primary_keys,
View sha1sum.html
<!-- You may need to download them from -->
<script src="rollups/sha1.js"></script>
<script src='components/lib-typedarrays-min.js'></script>
function sha1sum() {
var oFile = document.getElementById('uploadFile').files[0];
var sha1 = CryptoJS.algo.SHA1.create();
var read = 0;
AaronGhent / p4merge install
Created Jan 17, 2014
Installs p4merge on a linux based machine
View p4merge install
# p4merge for 64 bit
# p4merge for 32 bit
# wget
tar zxvf p4v.tgz
sudo cp -r p4v-* /usr/local/p4v/
sudo ln -s /usr/local/p4v/bin/p4merge /usr/local/bin/p4merge
plentz / nginx.conf
Last active Jan 15, 2021
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
You can’t perform that action at this time.