Skip to content

Instantly share code, notes, and snippets.

View arnavs's full-sized avatar
🐧
if it's not free, it's not worth paying for

Arnav Sood arnavs

🐧
if it's not free, it's not worth paying for
View GitHub Profile
@arnavs
arnavs / script.py
Created April 13, 2021 02:01
update coinbase pro DCA for Python 3
# secrets
API_KEY = "something"
API_PASS = "something else"
API_SECRET = "also something else"
# boilerplate
import requests
import json, hmac, hashlib, time, requests, base64
from requests.auth import AuthBase
using ModelingToolkit, Test, SparseArrays
@variables a b c
# Auxiliary Functions and Constants
get_sparsity_pattern(h::Array{Expression}) = sparse(Int64.(map(~, h .=== ModelingToolkit.Constant(0))))
get_sparsity_pattern(h::SparseMatrixCSC{Expression,Int64}) = sparse(Int64.(map(~, h .=== ModelingToolkit.Constant(0))))
get_sparsity_pattern(h::SparseVector{Expression,Int64}) = sparse(Int64.(map(~, h .=== ModelingToolkit.Constant(0))))
input = [1, 2, 3]
@arnavs
arnavs / covid.jl
Last active March 31, 2020 17:31
COVID Analysis
# data source is: https://pomber.github.io/covid19/timeseries.json
# data is updated thrice daily from Johns Hopkins numbers
using Pkg
pkg"activate .."
using JSON, Statistics, Plots, Dates, LsqFit, TimeSeries
data = JSON.parsefile("../data/timeseries_03_31_20.json");
# Aggregate statistics
function unpack_country(country)
@arnavs
arnavs / git_create_orphan.sh
Last active November 22, 2019 21:38
Orphan Branch
git checkout --orphan docs
git rm -rf .
git commit --allow-empty -a -m "Initial Commit"
git push origin docs
@arnavs
arnavs / search.jl
Last active July 20, 2017 14:55
A script to help with debate research.
# A script to take one list of words (topic-related), and one list of words (philosophy-related), and get searches for all the related words.
# Dependencies.
using Requests
using JSON
apikey = "919db630ecc84118a1acc2914dc7bd55"
# Words.
topicWords = ["health care", "single payer", "public option"]
philWords = ["genealogy", "phenomenology", "Foucault"]
@arnavs
arnavs / business-side.jl
Created July 16, 2017 23:17
Some code to handle the business side of your startup.
using Requests
using JSON
# Import API key.
include("apikey.jl")
response = get("https://wordsapiv1.p.mashape.com/words/?partOfSpeech=noun&random=true"; headers=Dict("X-Mashape-Key" => "$key"))
word = JSON.parse(readstring(response))["word"]
startup = rand(["Uber", "AirBnB", "Tinder", "Oracle"])