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
// source: https://stackoverflow.com/questions/288739/generate-random-numbers-uniformly-over-an-entire-range | |
#include <iostream> | |
#include <random> | |
int main() { | |
const int range_from = 0; | |
const int range_to = 6; | |
std::random_device rand_dev; | |
std::mt19937 generator(rand_dev()); | |
std::uniform_int_distribution<int> distr(range_from, range_to); |
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
digraph { | |
//rankdir=LR | |
node[fontname=Roboto, style=rounded, shape=box] | |
edge[fontname=Roboto] | |
api_gateway [label=<api gateway<br/><font point-size="10">port:123</font>>] | |
config [label=<config<br/><font point-size="10">port:456</font>>] | |
discovery [label=<discovery<br/><font point-size="10">port:789</font>>] | |
hello [label="hello service"] | |
foo [label="foo service"] | |
bar [label="bar service"] |
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
require(RCurl) | |
require(jsonlite) | |
myticker<-"FB" | |
url.histprice<-function(x){ return(paste0("http://globalquote.morningstar.com/globalcomponent/RealtimeHistoricalStockData.ashx?ticker=",x,"&showVol=true&dtype=his&f=d&curry=USD&range=1900-1-1|2014-10-10&isD=true&isS=true&hasF=true&ProdCode=DIRECT"))} | |
url.keyratios<-function(x){return(paste0("http://financials.morningstar.com/ajax/exportKR2CSV.html?t=",x))} | |
#Retrieve historical prices | |
json.histprice<-getURL(url.histprice(myticker)) | |
json.histprice<-sub("NaN","\"NA\"",json.histprice) |
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 datetime import date | |
from datetime import timedelta | |
def calc_easter_sunday(year: int) -> date: | |
""" | |
Returns Easter as a date object. | |
An implementation of Butcher's Algorithm for determining the date of Easter for the Western church. | |
Works for any date in the Gregorian calendar (1583 and onward). | |
Reference: http://code.activestate.com/recipes/576517-calculate-easter-western-given-a-year/ | |
""" |
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
This Gist contains an example of how to write a a FIX protocol parser using QuickFIX/J. | |
It also includes the XML data dictionary and a sample FIX message file with one OrderList message. | |
If you want to build/run this, you will need to link with QuickFIX/J and Jackson jars: | |
quickfixj-all-1.5.3.jar | |
mina-core-1.1.7.jar | |
slf4j-api-1.6.3.jar | |
log4j-1.2.15.jar | |
jackson-core-2.5.1.jar | |
jackson-databind-2.5.1.jar | |
jackson-annotations-2.5.1.jar |
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 | |
# /usr/local/sbin/GeoIP_update | |
# | |
# Update geoip databases for xtables geoip module of iptables | |
# Last updated: 20150513 | |
# | |
XTABLESADDONS=/usr/lib/xtables-addons/ | |
XTABLEGEOIPDIR=/usr/share/xt_geoip/ |