Skip to content

Instantly share code, notes, and snippets.

View wjurkowlaniec's full-sized avatar
🎹

Wojtek Jurkowlaniec wjurkowlaniec

🎹
View GitHub Profile
@only-entertainment
only-entertainment / vin_validation.py
Created March 24, 2012 00:42
Validate a VIN using Python
class VINLookupForm(Form):
"""
Lookup a VIN form
"""
vin = TextField(u'Enter VIN',
validators=[validators.Required(u'VIN is required for lookup.')])
def validate_vin(self, field):
"""
Validate a VIN against the 9th position checksum
@stefansundin
stefansundin / extract-attachments.py
Last active September 27, 2022 18:54
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Instructions:
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original".
# Move the files to the same directory as this program, then run it.
import sys
@chiihuang
chiihuang / Kill Multiple Op in MongoDB 3.2
Created June 13, 2016 14:47
Kill Multiple Op in MongoDB 3.2 when opid sometimes negative
// Change mydb.mycollection to your target ns
var result = db.currentOp();
result.inprog.filter(function(p){return p.ns === 'mydb.mycollection';}).map(function(p){return p.opid >= 0 ? p.opid : Math.pow(2,32) + p.opid;}).forEach(function(pid){ db.killOp(pid);});