Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
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
nirizr / full_upsert.py
Last active Dec 22, 2020
sqlalchemy upsert supporting delayed ORM insertion and duplicate removal (inside a single query)
View full_upsert.py
def upsert(session, model, rows):
table = model.__table__
stmt = postgresql.insert(table)
primary_keys = [key.name for key in inspect(table).primary_key]
update_dict = {c.name: 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
<html>
<!-- You may need to download them from https://github.com/brix/crypto-js/tree/release-3.1.2/build -->
<script src="rollups/sha1.js"></script>
<script src='components/lib-typedarrays-min.js'></script>
<body>
<script>
function sha1sum() {
var oFile = document.getElementById('uploadFile').files[0];
var sha1 = CryptoJS.algo.SHA1.create();
var read = 0;
@AaronGhent
AaronGhent / p4merge install
Created Jan 17, 2014
Installs p4merge on a linux based machine
View p4merge install
# p4merge for 64 bit
wget http://www.perforce.com/downloads/perforce/r13.4/bin.linux26x86_64/p4v.tgz
# p4merge for 32 bit
# wget http://www.perforce.com/downloads/perforce/r13.4/bin.linux26x86/p4v.tgz
tar zxvf p4v.tgz
sudo cp -r p4v-* /usr/local/p4v/
sudo ln -s /usr/local/p4v/bin/p4merge /usr/local/bin/p4merge
@plentz
plentz / nginx.conf
Last active Jan 15, 2021
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
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.