Skip to content

Instantly share code, notes, and snippets.

View nathanvy's full-sized avatar
🔌
unlimited power

nathanvy

🔌
unlimited power
View GitHub Profile
@nathanvy
nathanvy / capm.py
Last active July 19, 2024 05:08
Quick script to compute CAPM-derived cost of equity
import yfinance as yf
import numpy as np
def get_data(ticker, start_date, end_date):
stock_data = yf.download(ticker, start=start_date, end=end_date)
return stock_data['Adj Close']
def compute_beta(stock_prices, index_prices):
stock_returns = stock_prices.pct_change().dropna()
index_returns = index_prices.pct_change().dropna()
@nathanvy
nathanvy / run-today-p.lisp
Created July 9, 2023 20:50
Predicate to determine if market is open today
(defun run-today-p ()
"Should we run zalgo today?"
(local-time:with-decoded-timestamp
(:day-of-week weekday :day today-day) (local-time:now)
(when (or (= weekday 0) (= weekday 6)) (return-from run-today-p nil))
(let ((markets-list (get-markets-list)))
(loop for market in markets-list
do (if (string= (gethash "name" market) "NYSE")
(local-time:with-decoded-timestamp
(:day d) (local-time:parse-timestring (gethash "startTime" market))
@nathanvy
nathanvy / minimal config
Created June 8, 2023 00:54
R Test Case
;;;;; this goes into init.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
@nathanvy
nathanvy / pentest-arsenal.md
Created February 3, 2023 06:49 — forked from heinthanth/pentest-arsenal.md
Penetration Testing Tools for MacOS X
  • [] radare2 - brew
  • [] cutter (radare2) - brew cask
  • [] ghidra - brew cask
  • [] ida-free - brew cask
  • [] nmap - brew
  • [] proxychains - brew (https://gist.github.com/allenhuang/3792521)
  • [] sqlmap - brew
  • [] powershell - brew cask
  • [] impacket scripts - git
  • [] powersploit - git
@nathanvy
nathanvy / gist:2c080ee0b7e93b11e544c5275d31f2b1
Created November 6, 2022 22:56
Can't get Vega-lite to show me any visualization
{
"data": {
"values": [
{
"date": "2020-12-31",
"open": 12852.959961,
"high": 12904.089844,
"low": 12804.75,
"close": 12888.280273,
"adjClose": 12888.280273,
@nathanvy
nathanvy / spx.csv
Created May 8, 2022 17:24
stock data
We can't make this file beautiful and searchable because it's too large.
spxdate,open,high,low,close
1990-01-02,353.3999938964844,359.69000244140625,351.9800109863281,359.69000244140625
1990-01-03,359.69000244140625,360.5899963378906,357.8900146484375,358.760009765625
1990-01-04,358.760009765625,358.760009765625,352.8900146484375,355.6700134277344
1990-01-05,355.6700134277344,355.6700134277344,351.3500061035156,352.20001220703125
1990-01-08,352.20001220703125,354.239990234375,350.5400085449219,353.7900085449219
1990-01-09,353.8299865722656,354.1700134277344,349.6099853515625,349.6199951171875
1990-01-10,349.6199951171875,349.6199951171875,344.32000732421875,347.30999755859375
1990-01-11,347.30999755859375,350.1400146484375,347.30999755859375,348.5299987792969
1990-01-12,348.5299987792969,348.5299987792969,339.489990234375,339.92999267578125
@nathanvy
nathanvy / sbcl-stacktrace.txt
Last active April 14, 2022 06:14
SBCL no worky
;; slynk:close-connection: end of file on #<SB-SYS:FD-STREAM for "socket 127.0.0.1:4005, peer: 127.0.0.1:44084" {100195D503}>
;; closing 1 channels
Help! 11 nested errors. SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.
Backtrace for: #<SB-THREAD:THREAD "Slynk Sentinel" RUNNING {100722A703}>
0: (SLYNK::MAYBE-SLOW-DOWN)
1: (SLYNK::SEND-TO-EMACS (:DEBUG 2 6 ("The variable SLYNK::*SEND-COUNTER* is unbound." " [Condition of type UNBOUND-VARIABLE]" NIL) (("CONTINUE" "Retry using SLYNK::*SEND-COUNTER*.") ("USE-VALUE" "Use specified value.") ("STORE-VALUE" "Set specified value and use it.") ("ABORT" "Return to sly-db level 5.") ("ABORT" "Return to sly-db level 4.") ("ABORT" "Return to sly-db level 3.") ("ABORT" "Return to sly-db level 2.") ("ABORT" "Return to sly-db level 1.") ("ABORT" "abort thread (#<THREAD \"Slynk Sentinel\" RUNNING {100722A703}>)")) ((0 "(SLYNK::MAYBE-SLOW-DOWN)" . #1=((:RESTARTABLE T))) (1 #<(SIMPLE-ARRAY CHARACTER (202)) (SLYNK::SEND-TO-EMACS (:DEBUG 2 5 ("The variable SLYNK::*SEND-COUNTER* is un
@nathanvy
nathanvy / math.lisp
Created January 17, 2021 06:15 — forked from mheise/math.lisp
Some common math implemented in common lisp
(defun sum(l)
(reduce #'+ l))
(defun avg (a &rest rest)
(/ (apply #'+ a rest) (+ 1 (length rest))))
(defun fact(n)
(if (or (= n 1) (= n 0))
1
(* n (fact (- n 1)))))
108.162.219.193 - - [08/Jun/2020:03:47:03 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=9000&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
108.162.219.107 - - [08/Jun/2020:03:47:16 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=8242&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
162.158.63.173 - - [08/Jun/2020:03:47:25 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=9000&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
173.245.52.74 - - [08/Jun/2020:03:47:31 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=8242&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
108.162.219.115 - - [08/Jun/2020:03:47:47 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=8242&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
162.158.63.115 - - [08/Jun/2020:03:47:47 +0000] "GET /?type=shoutcast&ip=scj.jejestreaming.com&port=9000&cover_t=large&mount=&ruid=&json=1 HTTP/1.1" 200 396 "-" "-"
162.158.63.203 - - [08/Jun/2020: