This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------- | |
# ------- banzhaf - version 1.1 | |
# ------- | |
# ------- A simple self-contained function to compute the Banzhaf Power Index given: | |
# ------- * a list of integer weights for all voters in the system, sorted in ascending order | |
# ------- * the quota for the voting system | |
# ------- | |
# ------- This is a slight modification (mainly vectorization) of the code by | |
# ------- Ruben R. Puentedura (http://www.hippasus.com/resources/socialsoftware/index.html) | |
# ------- which was published under CC-License in 2004 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: SKS 1.1.4 | |
Comment: Hostname: pgp.mit.edu | |
mQENBFLOhGwBCADLreJzn4F8bKodTjg/QY4AyvQQWxnM0h56xsUmqTZqvRCp9kgtrcR5Bnvp | |
kMMRoIx9rOM7Hnp/LrxogZ8ZHbp+r3eQt3tp8p7ZwymQCT8cZoreTQplDp4eqZmnPh4BMk3a | |
+gqvgPv5SShwQjNGtf8r31MWe+xTCx6Db1XYpHav0pSs06Gmf/Kh/WVMtTvh841R0OU9mWhk | |
OxnOYWDErPSzUolA9u4A20B3LVpowjoA5Oaq3kIzC+mgL7muXhiEA4hzL9WXqcDHPXyRS3ut | |
Djmz1oqXFIZFgwhUUDW6g1hyuVuulNZRMkFtqASi13x+qMF8PwbU6KvoVCXG9++yQF13ABEB | |
AAG0K0hlaW5yaWNoIEhhcnRtYW5uIDxoYXJ0bWFubkB1bmkta29ibGVuei5kZT6JAT4EEwEC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as G | |
from time import sleep | |
import sys | |
if (len(sys.argv) < 1): exit | |
pin = int(sys.argv[-1]) | |
MODE = "BCM" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pylab as plt | |
from scipy import stats | |
from collections import * | |
from itertools import * | |
# | |
# Convenience Class for Time Series | |
# | |
# Series Objects can be added and subtracted using infix operators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Analog Input with ADC0832 chip | |
# | |
# Datasheet: http://www.ti.com/lit/ds/symlink/adc0838-n.pdf | |
# Part of SunFounder LCD StarterKit | |
# http://www.sunfounder.com/index.php?c=show&id=21&model=LCD%20Starter%20Kit | |
# | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Import the ADC driver: | |
# https://gist.github.com/HeinrichHartmann/27f33798d12317575c6c | |
import ADC0832 as ADC | |
import sys | |
import BaseHTTPServer | |
import json | |
from BaseHTTPServer import BaseHTTPRequestHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
_G = nil --[[ref]], | |
_VERSION = "Lua 5.1", | |
arg = { | |
[-1] = "/usr/bin/lua", | |
[0] = "main.lua" | |
} --[[table: 0xbcbef0]], | |
assert = assert --[[function: 0xbc5310]], | |
collectgarbage = collectgarbage --[[function: 0xbc5370]], | |
coroutine = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2015 Heinrich Hartmann | |
# MIT License http://choosealicense.com/licenses/mit/ | |
import gdata.spreadsheet.service | |
class GoogleDriveConnection(object): | |
def __init__(self, email, password): | |
self.client = gdata.spreadsheet.service.SpreadsheetsService() | |
self.client.ClientLogin(email, password) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
import numpy as np | |
X = np.genfromtxt("DataSets/RequestRates.csv", delimiter=",")[:,1] | |
bins = [500, 700, 800, 900, 1000, 1500, 1800, 2000, 2200] | |
bin_count = len(bins) - 1 | |
sample_counts = [0] * bin_count | |
for x in X: | |
for i in range(bin_count): | |
if (bins[i] <= x) and (x < bins[i + 1]): | |
sample_counts[i] += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Similar to: http://stackoverflow.com/questions/43765/pin-emacs-buffers-to-windows-for-cscope/65992#65992 | |
(defun pin-buffer () | |
"Pin buffer to current window." | |
(interactive) | |
(message | |
(if (let (window (get-buffer-window (current-buffer))) | |
(set-window-dedicated-p window (not (window-dedicated-p window)))) | |
"pinned buffer" "un-pinned buffer") | |
)) |