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
# Plot theme | |
COLOR = "#2A0933" | |
plt.rcParams['text.color'] = COLOR | |
plt.rcParams['text.hinting_factor'] = 8 | |
plt.rcParams['axes.labelcolor'] = COLOR | |
plt.rcParams['axes.facecolor'] = "eeeeee" | |
plt.rcParams['axes.edgecolor'] = "bcbcbc" | |
plt.rcParams['axes.grid'] = True | |
plt.rcParams['axes.titlesize'] = "x-large" | |
plt.rcParams['axes.labelsize'] = "large" |
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 numpy as np | |
# Core functions | |
def ols(X, y): | |
ret = np.dot(np.dot(np.linalg.inv(np.dot(X.transpose(), X)), X.transpose()), y) | |
return ret.tolist() | |
def se(arr): | |
return np.std(arr) / arr.size |
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
theme_Publication <- function(base_size=14, base_family="helvetica") { | |
library(grid) | |
library(ggthemes) | |
(theme_foundation(base_size=base_size, base_family=base_family) | |
+ theme(plot.title = element_text(face = "bold", | |
size = rel(1.2), hjust = 0.5), | |
text = element_text(), | |
panel.background = element_rect(colour = NA), | |
plot.background = element_rect(colour = NA), | |
panel.border = element_rect(colour = NA), |
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
(ns | |
^{:doc "Convert a CSV in to Oracle insert statements. | |
This program takes as input | |
1. A CSV. Some care is taken to remove whitespace and quotes from | |
elements of the CSV. | |
2. A tablename. The tablename is used to both name | |
the table we are inserting the csv in to as well as | |
the name of the sql file that is generated. | |
Returns a tablename.sql file full of insert statements." | |
:author "Rishi Sadhir"} |
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 copy-line (arg) | |
"Copy lines (as many as prefix argument) in the kill ring" | |
(interactive "p") | |
(kill-ring-save (line-beginning-position) | |
(line-beginning-position (+ 1 arg))) | |
(message "%d line%s copied" arg (if (= 1 arg) "" "s"))) | |
;; optional key binding | |
(global-set-key "\C-c\C-k" 'copy-line) |
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
(defn print-logger | |
[writer] | |
#(binding [*out* writer] | |
(println %))) | |
(defn file-logger | |
[file] | |
#(with-open [f (clojure.java.io/writer file :append true)] | |
((print-logger f) %))) | |
;; Usage |