Handy Python functions written by Andrey Petrov (shazow). I release this code
under public domain. (Attribution is optional but appreciated.)
Approximate changelog (according to
- I made a proper github repo out of this:
#!/usr/bin/env python
"""A simple python script template.
from __future__ import print_function
import os
import sys
import argparse
View gist:b285c1c2f159be1c8e3136b787c36ac3
## Simple Python module to upload files to Google Drive
# Needs a file 'client_secrets.json' in the directory
# The file can be obtained from
# under APIs&Auth/Credentials/Create Client ID for native application
# To test usage:
# import google_drive_util
# google_drive_util.login()
# google_drive_util.test()
View gist:afbca177d1087013873c
morseAlphabet ={
"A" : ".-",
"B" : "-...",
"C" : "-.-.",
"D" : "-..",
"E" : ".",
"F" : "..-.",
"G" : "--.",
"H" : "....",
"I" : "..",

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.


$ npm install mongoose --save


const mongoose = require('mongoose');
# Solve n-queens problem with picosat
import pycosat
import numpy
import itertools
def get_cnf(N):
cnf = []
# * convert to object because pycosat expects 'int's
# * add 1 because 0 is reserved in pycosat
View ruby-dbus-and-banshee.rb
#!/usr/bin/env ruby
require 'dbus'
bus = DBus::SessionBus.instance
banshee_service = bus.service("org.bansheeproject.Banshee")
banshee = banshee_service.object("/org/bansheeproject/Banshee/PlayerEngine")
puts banshee.introspect
#!/usr/bin/env python
#Copyright (C) 2009 Nikitas Stamatopoulos
# Modified by 2009-10
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#!/usr/bin/env python
# encoding: utf8
from unicodedata import normalize
from string import ascii_letters
from random import randint
# Miller-Rabin probabilistic primality test (HAC 4.24)
# returns True if n is a prime number
# n is the number to be tested
# t is the security parameter