I hereby claim:
- I am joshuaulrich on github.
- I am joshuaulrich (https://keybase.io/joshuaulrich) on keybase.
- I have a public key ASDcjSYFiNY5lotsu7tcXthTsae6mRwUHF1G48R03YG-AQo
To claim this, I am signing this object:
void do_gc(SEXP env) { | |
SEXP s, t; | |
PROTECT(s = t = allocList(1)); | |
SET_TYPEOF(s, LANGSXP); | |
SETCAR(t, install("gc")); t = CDR(t); | |
PrintValue(eval(s, env)); | |
UNPROTECT(1); | |
} |
getOptionOld <- function(x, default = NULL) { | |
if(missing(default) || x %in% names(options())) | |
.Internal(getOption(x)) | |
else | |
default | |
} | |
getOptionNew <- function(x, default = NULL) { | |
ans <- .Internal(getOption(x)) | |
if(is.null(ans)) default else ans |
#!/usr/bin/perl | |
# Usage: read -s PASSWORD && ./bcrypt-password.pl | |
use Crypt::Eksblowfish::Bcrypt; | |
# Read password and salt from environment variables | |
$password = $ENV{PASSWORD}; | |
$salt = "lfVQ/T2N3dhFVvvPro2Hfu" | |
$encrypted = encrypt_password($password, $salt); | |
# Extract bcrypt version, cost, salt, and hashed password |
I hereby claim:
To claim this, I am signing this object:
With the introduction of GitHub's Squash and Merge feature, this has become less prevelant, however it's still useful in scenarios where GitHub's interface is unavailable.
Let's talk through two ways to do a squash and merge on the command line.
When to use it
update.realtime <- | |
function(ticker, history = NULL) | |
{ | |
if (is.null(history)) { | |
history <- getSymbols(ticker, from = "2018-01-01", auto.assign = FALSE) | |
} | |
today <- getQuote(ticker, src = "yahoo") | |
now <- as.Date(today[,"Trade Time"]) | |
cn <- c("Open", "High", "Low", "Last", "Volume", "Last") | |
live <- xts(today[, cn], now) |
require(quantmod) | |
do_chart <- function(symbol) { | |
quote <- getQuote(symbol) | |
quote$Close <- quote$Last | |
xts(OHLCV(quote), quote[,"Trade Time"], | |
pct_change = quote[,"% Change"]) | |
} | |
filename <- "intraday-sp500.rds" |
#!/usr/bin/awk -f | |
# GNU Awk 3.1.8 | |
# | |
# Tutorial: | |
# http://www.grymoire.com/Unix/Awk.html | |
# | |
BEGIN{ FS=","; OFS=","; filename="" } | |
{ | |
if(NR==1) { # the first record/line is the header | |
header=substr($0,8) # store to write to each symbol file |
date | exchange | status | start_time | end_time | holiday_name | |
---|---|---|---|---|---|---|
2000-01-17 | NYSE | closed | Martin Luther King's Birthday | |||
2000-02-21 | NYSE | closed | Washington's Birthday | |||
2000-04-21 | NYSE | closed | Good Friday | |||
2000-05-29 | NYSE | closed | Memorial Day | |||
2000-07-03 | NYSE | short day | 09:30 | 13:00 | Independence Day | |
2000-07-04 | NYSE | closed | Independence Day | |||
2000-09-04 | NYSE | closed | Labor Day | |||
2000-11-23 | NYSE | closed | Thanksgiving Day | |||
2000-11-24 | NYSE | short day | 09:30 | 13:00 | Black Friday |