Skip to content

Instantly share code, notes, and snippets.

Avatar

Ellis Valentiner ellisvalentiner

View GitHub Profile
@ellisvalentiner
ellisvalentiner / download-goes.jl
Created Mar 26, 2018
Download GOES-R imagery
View download-goes.jl
url = "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/GEOCOLOR/1808x1808.jpg"
while true
download(url, "images/$(now()).jpg")
sleep(54000)
end
@ellisvalentiner
ellisvalentiner / install-python-3.sh
Created Feb 17, 2018
Install script for Python 3 on Raspbian
View install-python-3.sh
#!/usr/local/bin/bash
# sudo apt-get -y update && sudo apt-get upgrade
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar xf Python-3.6.4.tar.xz
cd Python-3.6.4
./configure
make
sudo make altinstall
sudo rm -rf Python-3.6.4.tar.xz
View Speed Test Pi
using Distributions
using Requests
function main()
while true
result = speedtest()
out = """$(result["timestamp"]),$(result["serverinfo"]["city"]),$(result["serverinfo"]["ip"][1]),$(result["serverinfo"]["fqdn"]),$(result["serverinfo"]["site"]),$(result["upload"]),$(result["download"])\n""";
f = open("/home/pi/speedresults.csv", "a")
write(f, out)
close(f)
@ellisvalentiner
ellisvalentiner / install_julia.sh
Created Nov 6, 2017
Script to build Julia on Raspberry Pi
View install_julia.sh
#!/usr/bin/env bash
# XXX - for making newly created files/directories less restrictive
umask 0022
# colors
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
RESET="\033[0m"
View Installer Log 22-Oct-2017.log
Oct 22 16:59:33 localhost opendirectoryd[183]: opendirectoryd (build 483.100) launched - installer mode
Oct 22 16:59:33 localhost opendirectoryd[183]: [default] Failed to open file <private> [2: No such file or directory]
Oct 22 16:59:34 localhost opendirectoryd[183]: [default] Initialize trigger support
Oct 22 16:59:34 localhost opendirectoryd[183]: [default] Failed to open file <private> [2: No such file or directory]
Oct 22 16:59:34 localhost opendirectoryd[183]: [default] Failed to open file <private> [2: No such file or directory]
Oct 22 16:59:34 localhost opendirectoryd[183]: [default] created endpoint for mach service 'com.apple.private.opendirectoryd.rpc'
Oct 22 16:59:34 localhost opendirectoryd[183]: [session] Registered RPC over XPC 'reset_cache' for service 'com.apple.private.opendirectoryd.rpc'
Oct 22 16:59:34 localhost opendirectoryd[183]: [session] Registered RPC over XPC 'reset_statistics' for service 'com.apple.private.opendirectoryd.rpc'
Oct 22 16:59:34 localhost opendirectoryd[183]: [session
@ellisvalentiner
ellisvalentiner / bulk-insert.py
Last active Feb 3, 2021
Recipe for (fast) bulk insert from python Pandas DataFrame to Postgres database
View bulk-insert.py
#!/usr/bin/env/python
import psycopg2
import os
from io import StringIO
import pandas as pd
# Get a database connection
dsn = os.environ.get('DB_DSN') # Use ENV vars: keep it secret, keep it safe
conn = psycopg2.connect(dsn)
View brew_deps.R
library(purrr)
library(dplyr)
library(tidyr)
deps <- readLines("~/Desktop/deps.txt")
df <- deps %>%
map(strsplit, split=": ") %>%
flatten %>% map_if(~length(.x) == 1L, ~c(.x, NA)) %>%
do.call(rbind.data.frame, .)
colnames(df) <- c("pkg", "dep")
@ellisvalentiner
ellisvalentiner / read_dir.R
Created Feb 6, 2017
Read all CSV files in a directory and return as a tibble. (Who knows how this might fail)
View read_dir.R
library(tidyverse)
all_df <- list.files("./data", full.names = TRUE) %>%
map_df(., read_csv)
View homebrew-revive.sh
#!/usr/bin/env bash
# Notes:
# - tsort requires as input a stream of pairs (a, b) where package a depends
# on package b. If package a has k > 1 dependencies, we should have k lines
# associated to it; if package a has no dependencies, then we should have a
# single line (a, a). The pairs are just space delimited, no parentheses.
# the little awk program below formats the data that way for tsort.
# - tsort outputs the order from bottom to top; that's why we need to reverse
# it with tail -r.
@ellisvalentiner
ellisvalentiner / # qgis - 2016-11-21_09-29-26.txt
Created Nov 21, 2016
qgis (homebrew/science/qgis) on macOS 10.11.6 - Homebrew build logs
View # qgis - 2016-11-21_09-29-26.txt
Homebrew build logs for homebrew/science/qgis on macOS 10.11.6
Build date: 2016-11-21 09:29:26