Skip to content

Instantly share code, notes, and snippets.

View seperman's full-sized 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 September 28, 2023 23:19
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 = [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,
<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 January 17, 2014 01:02
Installs p4merge on a linux based machine
# 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 March 31, 2024 18:40
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048