Skip to content

Instantly share code, notes, and snippets.

@playpauseandstop
playpauseandstop / sync-it
Created January 15, 2011 00:49
Additional wrapper to rsync command with profiles.
#!/usr/bin/env python
#
# Additional wrapper to ``rsync`` command with profiles.
#
# Requirements
# ============
#
# * Python_ 2.4 or higher
# * rsync_
#
@juntalis
juntalis / spauth.py
Created April 1, 2012 07:46
Claims-based Authentication Example for interacting with Sharepoint Online
import os, requests, re
from htmlentitydefs import name2codepoint
from simplejson import loads, dumps
spauth = None
def unescape(s):
name2codepoint['#39'] = 39
return re.sub('&(%s);' % '|'.join(name2codepoint),
lambda m: unichr(name2codepoint[m.group(1)]), s)
@mrchief
mrchief / LICENSE.md
Last active October 12, 2024 15:35
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@corpit
corpit / upc_check_digit.py
Created January 1, 2014 02:59
Calculate UPC-A check digit in Python
def add_check_digit(upc_str):
"""
Returns a 12 digit upc-a string from an 11-digit upc-a string by adding
a check digit
>>> add_check_digit('02345600007')
'023456000073'
>>> add_check_digit('21234567899')
'212345678992'
>>> add_check_digit('04210000526')
@G33kDude
G33kDude / GDI.ahk
Last active August 11, 2019 06:48
GDI wrapper for AutoHotkey
class GDI
{
__New(hWnd, CliWidth=0, CliHeight=0)
{
if !(CliWidth && CliHeight)
{
VarSetCapacity(Rect, 16, 0)
DllCall("GetClientRect", "Ptr", hWnd, "Ptr", &Rect)
CliWidth := NumGet(Rect, 8, "Int")
CliHeight := NumGet(Rect, 12, "Int")
@kurohai
kurohai / spauth.py
Last active August 29, 2015 14:17 — forked from juntalis/spauth.py
import os
import requests
import re
from pprint import pprint
from htmlentitydefs import name2codepoint
from simplejson import loads
class spauth:
@zamber
zamber / gen-menu.py
Last active May 21, 2020 15:57
A simple and dirty menu generator for MkDocs. Human sorting, titlecase and automatic numeration.
#!/usr/bin/python
# https://gist.github.com/zamber/af5086cb9c097be5c002
import os
import re
from titlecase import titlecase # pip install titlecase
# Config
root = 'src'
os.chdir(root)
@graymouser
graymouser / hb_all_books_dl.js
Created February 28, 2016 14:09
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});
@lmyyao
lmyyao / sqlalchemy_bind_two_database.py
Created September 14, 2016 06:39
sqlalchemy bind multiple databases
from sqlalchemy import (String,
Integer,
engine_from_config,
Column)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base_1 = declarative_base()
Base_2 = declarative_base()
import smpplib2.gsm
import smpplib2.client
import smpplib2.consts
import smpplib2.exceptions
# TODO: update these based on the address/credentials for the SCSM server
SMSC_ADDRESS = '127.0.0.1'
SMSC_PORT = 1234
SMSC_SYSTEM_ID = 'pavel'
SMSC_PASSWORD = 'wpsd'