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
#!/usr/bin/env python3 | |
# ~*~ encoding: utf-8 ~*~ | |
""" | |
make random drink for ben | |
""" | |
import random | |
from collections import Counter | |
MAX_PARTS = 10 |
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
url = "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/GEOCOLOR/1808x1808.jpg" | |
while true | |
download(url, "images/$(now()).jpg") | |
sleep(54000) | |
end |
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
#!/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 |
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
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) |
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
#!/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" |
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
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 |
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
#!/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) |
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
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") |
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
library(tidyverse) | |
all_df <- list.files("./data", full.names = TRUE) %>% | |
map_df(., read_csv) |
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
#!/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. |
NewerOlder