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 datetime | |
from dateutil.relativedelta import relativedelta | |
import pandas as pd | |
from pandas.tseries.offsets import BDay | |
def crude_futures_lasttradingday(contract_month): | |
"""Trading in the current delivery month shall cease on the third business | |
day prior to the twenty-fifth calendar day of the month preceding the | |
delivery month. If the twenty-fifth calendar day of the month is a | |
non-business day, trading shall cease on the third business day prior to the |
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
sess = dryscrape.Session() | |
sess.set_header("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:41.0) Gecko/20100101 Firefox/41.0") | |
sess.visit("https://carelink.minimed.eu/patient/") | |
username = sess.at_xpath('//*[@id="j_username"]') | |
username.set("your_username") | |
password = sess.at_xpath('//*[@id="j_password"]') | |
password.set("your_password") | |
# submit form |
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 | |
# With the provided src and dest locations, will generate all the remaining | |
# thumbnails in the desired size. Use --force to regenerate | |
import argparse | |
from PIL import Image | |
import glob, os | |
def debug_display_files(files, debug_level=1): | |
files = list(files) | |
if args.debug >= 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
#!/usr/bin/python | |
""" | |
Save this file as server.py | |
>>> python server.py 0.0.0.0 8001 | |
serving on 0.0.0.0:8001 | |
or simply | |
>>> python server.py |
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
#!/bin/sh | |
############# | |
###<Notes>### | |
############# | |
# This script depends on screen. | |
# For the stop function to work, you must set an | |
# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc. | |
# If you typically just start rtorrent with just "rtorrent" on the | |
# command line, all you need to change is the "user" option. | |
# Attach to the screen session as your user with |
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
pcm.dsp0 { | |
type plug | |
slave.pcm "dmix" | |
# A hint is required for listing the device in some GUIs, e.g. Phonon configuration. | |
hint { | |
show on | |
description "My dmix dsp0" | |
} | |
} | |
# mixer0 can stay unchanged, because |
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 xmlrpclib, webbrowser | |
# EDIT: webfaction credentials | |
username = "USERNAME" | |
password = "PASSWORD" | |
# EDIT: email address domain (must exist in control panel) | |
mail_domain = "example.com" | |
# EDIT: domain on which you want to access gmail (must exist in control panel) |
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
# If an external monitor is connected, place it with xrandr | |
# External output may be "VGA" "VGA-0" "VGA1" or "DVI-0" or "TMDS-1" | |
EXTERNAL_OUTPUT="VGA1" | |
INTERNAL_OUTPUT="LVDS1" | |
# EXTERNAL_LOCATION may be one of: left, right, above, or below | |
EXTERNAL_LOCATION="right" | |
case "$EXTERNAL_LOCATION" in | |
left|LEFT) |
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
#!/bin/bash | |
# Moves torrents from the queue directory into the watch directory. | |
# | |
# Example usage: | |
# * manage_rtorrent_queue.sh movies 3 | |
# * manage_rtorrent_queue.sh software 1 | |
# Check for proper number of command line args. | |
EXPECTED_ARGS=2 |
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 | |
#http://engineering.richrelevance.com/bayesian-ab-tests/ | |
from numpy.random import beta as beta_dist | |
import numpy as np | |
N_samp = 10000 # number of samples to draw | |
clicks_A = 450 # insert your own data here | |
views_A = 56000 | |
clicks_B = 345 # ditto | |
views_B = 49000 | |
alpha = 1 |