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
(defun user--save-macro (name) | |
"Save a macro. Take a name as an argument and save the last defined macro under this name." | |
(interactive "SName of the macro :") | |
(kmacro-name-last-macro name) | |
(find-file "~/.emacs.d/macros.el") | |
(goto-char (point-max)) | |
(newline) | |
(insert-kbd-macro name) | |
(newline) | |
(save-buffer) |
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 | |
#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 |
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/bash | |
# Replace all long urls in MYFILE file with short urls using API from: | |
# https://github.com/briancray/PHP-URL-Shortener | |
MYFILE=~/somefile | |
DOMAIN=domain.com | |
URLSERVICE="http://$DOMAIN/shorten.php?longurl=" | |
# Get URL from todo list | |
URLLIST=$(grep "http://" $MYFILE | sed 's/.*http:\/\/\([^ ]*\).*/http:\/\/\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/env bash | |
cd ../src || exit 1 | |
for f in 20*_*.*; do | |
TIMESTAMP=${f%.*} # Remove extension | |
TIMESTAMP=`echo $TIMESTAMP | sed 's/_001$//'` # Remove _001 from *.3gp files | |
TIMESTAMP=`echo $TIMESTAMP | awk 'sub("..$", "")'` # Remove last two characters (seconds in the timestamp) | |
TIMESTAMP=`echo $TIMESTAMP | sed 's/_//'` | |
echo Setting $f to $TIMESTAMP | |
touch -mt $TIMESTAMP $f | |
touch -t $TIMESTAMP $f |
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
'base_shipping_hidden_tax_amount' | |
'base_currency_code' | |
'subtotal_incl_tax' | |
'shipping_method' | |
'billing_name' | |
'subtotal_canceled' | |
'base_discount_refunded' | |
'base_shipping_refunded' | |
'total_paid' | |
'base_adjustment_negative' |
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
kw = read.csv("~/Downloads/keywords.csv", skip=1) | |
kw.conv <- subset(kw, Keyword.state == "enabled" & Conv...1.per.click. > 0) | |
View(kw.conv) | |
convs <- unlist(c(kw.conv["Conv...1.per.click."])) | |
clicks <- unlist(c(kw.conv["Clicks"])) | |
prop.test(convs,clicks,alternative=c("greater")) |
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
func xmlrpc(url string, methodName string, args ...string) string { | |
// Marshal XML | |
type Param struct { | |
Entry string `xml:"value>string"` | |
} | |
type methodCall struct { | |
XMLName xml.Name `xml:"methodCall"` | |
MethodName string `xml:"methodName"` | |
Params []Param `xml:"params>param"` |
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/bash | |
echo "Untracked Projects:" | |
echo "-------------------" | |
for i in * | |
do | |
if [ -d $i ]; then | |
if ! [ -d $i/.git ]; then | |
echo $i | |
fi |