Skip to content

Instantly share code, notes, and snippets.

View dcalacci's full-sized avatar
🦩
wfh baby

Dana Calacci dcalacci

🦩
wfh baby
View GitHub Profile
@dcalacci
dcalacci / iBooks-convert.py
Created August 10, 2022 16:05
Convert iBooks to normal pub packages, maintaining metadata
import os
import subprocess
filenames = []
# old path with ibooks
oldpath = "/path/to/ibooks/"
# Path to store new epub files in
newpath = "/new/path/for/epubs/"
# Function to store all filenames in a list
@dcalacci
dcalacci / datahoarder.py
Last active January 8, 2021 19:43
pull URLs posted to a list of reddit threads for archival purposes. made for archiving media posted to a couple threads after the 1/6 insurrection attempt
import requests, json, re, time, itertools, datetime, sys, os, subprocess
from random import randint
redditThreads = [
"https://www.reddit.com/r/AccidentalRenaissance/comments/kryhzt/us_capitol_protests_megathread_please_post_all/",
"https://www.reddit.com/r/DataHoarder/comments/krx449/megathread_archiving_the_capitol_hill_riots/",
"https://www.reddit.com/r/news/comments/krvwkf/megathread_protrump_protesters_storm_us_capitol/",
"https://www.reddit.com/r/politics/comments/kryi79/megathread_us_capitol_locked_down_as_trump/",
"https://www.reddit.com/r/PublicFreakout/comments/khs5k2/happening_now_trump_supporters_trying_to_destroy/",
"https://www.reddit.com/r/news/comments/krue9q/capitol_police_order_evacuation_of_some_capitol/",
@dcalacci
dcalacci / get-bos-incident-reports.py
Last active May 14, 2020 02:12
Daily script to pull boston incident reports
from bs4 import BeautifulSoup
import time
import os
import requests
import urllib
f = urllib.request.urlopen('https://data.boston.gov/dataset/crime-incident-reports-august-2015-to-date-source-new-system')
soup = BeautifulSoup(f.fp)
# finds all the "primary" buttons on the page -- these are those blue ones --
@dcalacci
dcalacci / covid-mobility-sir.R
Last active May 7, 2020 20:47
contagion modeling with mobility O/D matrices
library(tidyverse)
library(data.table)
library(glue)
library(parallel)
library(pbmcapply)
here <- here::here
OD <- read_csv(here("output/OD.csv"))
OD.norm <- t(t(OD) / colSums(OD))
pop <- read_csv(here("output/pop.csv"), col_types="nc")
@dcalacci
dcalacci / blink.js
Last active June 18, 2019 13:42
blink shell theme
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dcalacci
dcalacci / nn.py
Last active July 25, 2017 19:55
Simple Neural Network in Tensorflow
## Authors: Dan Calacci
## Adapted from Natashe Jaque's NN code for PML '17
## intended to be used with a larger framework for deep learning
import tensorflow as tf
import numpy as np
import math
import json
import matplotlib.pyplot as plt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.