Skip to content

Instantly share code, notes, and snippets.

@cuddihyd
cuddihyd / retrying-example.py
Created May 12, 2016 16:51
Python retrying example
from retrying import retry
counter = 0
isnone=lambda x:x==None
@retry(retry_on_result=isnone, wait_fixed=2000, stop_max_delay=5000) #then try: stop_max_delay=5000
def thingy():
print("thingy()")
global counter
counter = (counter + 1) % 5
return "zero" if counter == 0 else None
@cuddihyd
cuddihyd / stdin-demo.py
Last active August 29, 2015 14:12
stdin-demo
#!/usr/bin/env python
"""
:Usage: ./test.py /var/tmp/python.log < ./data.csv > out.txt
"""
import sys
import pandas as pd
def main(src_file):
df = pd.read_csv(sys.stdin)
print df.shape, src_file
@cuddihyd
cuddihyd / win-drive-map.bat
Created August 15, 2014 18:25
Add a Windows drive-mapping to a particular sub-folder
net use t: \\hostname\subfolder /persistent:yes
@cuddihyd
cuddihyd / install.md
Last active August 29, 2015 14:01
kdb-question
dcuddihy@blackbox:~$ tree -shD q
q
├── [4.0K May  8 15:48]  l32
│   └── [531K May  3  9:54]  q
├── [ 18K May  3  9:54]  q.k
├── [ 228 Apr  3 19:12]  q.q
├── [3.0K Apr  1 17:01]  README.txt
├── [5.3K Jan 15  3:17]  s.k
├── [ 821 Jun 9 2013] sp.q
@cuddihyd
cuddihyd / b-pipe-func-test.md
Last active August 29, 2015 14:00
Func. Test: B-Pipe Ref. and Subscription Data

Overview

The goal is to functional-test our B-Pipe installation for Reference Data requests and Subscriptions.

Reference Data

The first test is to ensure we get back reference data for the deals and indices we're currently fetching via Bloomberg Legacy ETL.

General Setup

To prepare, I've cloned my local environment settings under /opt/etc/me.acr/pystack/nobody to a new fake environment called bpipe. I changed the [bloomberg] stanza to as follows:

@cuddihyd
cuddihyd / tx.delete-deal-events.sh
Created April 25, 2014 17:24
tx-delete-deal-events
+#!/usr/bin/env bash
+while read line
+do
+ curl -X DELETE http://localhost:8080/tx/deal-events/id/${line}
+done
# sudo -u ubuntu -i google docs get ".*" . -u "dcuddihy.acr.test@gmail.com"
# sudo pip install xlrd
import xlrd
wb = xlrd.open_workbook('acr-scorecard-forecast-input.xls')
wb.sheets()[0].cell(1,0)
@cuddihyd
cuddihyd / bbg-etl-tools-mvp.md
Last active August 29, 2015 13:56
BBG ETL Tools

BBG ETL Tools MVP

I've started this feature fork.

Goals

  • Add a daily deal EOD subscription via support-ticket;
  • Add a daily index EOD subscription via support-ticket;
  • Remove daily EOD subscription via support-ticket;
  • Daily deal and index EOD updates run from cron;
#!/usr/bin/env bash
set -e
set -x
echo "Starting: " $(date)
BBCONFIG_REPO=bbconfig-1.10
BBCONFIG_TAG=1.10.0
# Deploys new version of bbconfig
@cuddihyd
cuddihyd / logging.yaml
Created January 8, 2014 23:00
logging.yaml
version: 1
disable_existing_loggers: False
formatters:
file:
format: '%(asctime)s %(name)s %(filename)s %(lineno) -12s %(levelname)-8s %(message)s'
datefmt: '%m-%d %H:%M'
console:
format: '%(asctime)s %(name)-12s: %(levelname)-8s %(message)s'
datefmt: '%m-%d %H:%M'