Skip to content

Instantly share code, notes, and snippets.

@ellisvalentiner
ellisvalentiner / install_julia.sh
Created November 6, 2017 02:05
Script to build Julia on Raspberry Pi
#!/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"
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-python-3.sh
Created February 17, 2018 15:58
Install script for Python 3 on Raspbian
#!/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
@ellisvalentiner
ellisvalentiner / download-goes.jl
Created March 26, 2018 02:11
Download GOES-R imagery
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 / Installer Log 22-Oct-2017.log
Created October 22, 2017 18:07
High Sierra install fail
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 / fixRouteTable.sh
Last active April 23, 2020 16:54
Fix indentation
#!/bin/bash
while netstat -rn | grep -qi ${PROBLEM_IP}; do
sudo route -n flush
done
sudo ifconfig en0 down && sudo ifconfig en0 up
@ellisvalentiner
ellisvalentiner / bulk-insert.py
Last active January 10, 2023 19:03
Recipe for (fast) bulk insert from python Pandas DataFrame to Postgres database
#!/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)
@ellisvalentiner
ellisvalentiner / bitbucket-pipelines.yml
Created October 12, 2016 21:04
yaml to build R package for bitbucket pipelines continuous integration
image: rocker/hadleyverse:latest
pipelines:
default:
- step:
script:
- cd /opt/atlassian/pipelines/agent/build
- Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'
- Rscript -e 'devtools::build()'
- Rscript -e 'devtools::install(upgrade_dependencies = FALSE)'
#!/usr/bin/env python3
# ~*~ encoding: utf-8 ~*~
"""
make random drink for ben
"""
import random
from collections import Counter
MAX_PARTS = 10