Skip to content

Instantly share code, notes, and snippets.

View mattparrilla's full-sized avatar

Matt Parrilla mattparrilla

View GitHub Profile
// This is universal, works with Infura -- set provider accordingly
const ethers = require('ethers')
//const provider = ethers.getDefaultProvider('rinkeby')
const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL)
function hex_to_ascii(str1) {
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
@mattparrilla
mattparrilla / point_cloud_to_dsm.py
Created June 30, 2021 14:45
Process a directory of point cloud data into DSM geotiffs.
import argparse
import os
import pdal
def generate_dsm(input_fn):
"""Given an input point cloud, create a DSM GeoTIFF"""
def build_pipeline():
"""Create a JSON pipeline for consumption by PDAL."""
@mattparrilla
mattparrilla / find_lcm_port.py
Created November 7, 2019 21:40
Find LCM traffic on an unknown UDP port
#!/usr/bin/env python
import lcm
import multiprocessing
import argparse
def try_port(port, channel, timeout):
"""Look for LCM channel on port"""
def handler(c, d):
@mattparrilla
mattparrilla / debian-stretch.vimrc
Created December 8, 2017 16:44
My .vimrc for my debian stretch machine
execute pathogen#infect()
" turn on filetype plugin for csv-vim to work
:filetype plugin on
" enable helptags for command-t
call pathogen#helptags()
" Enable syntax highlighting.
syntax on
@mattparrilla
mattparrilla / .svn_completion_remote_paths.sh
Created October 24, 2017 18:05 — forked from androa/.svn_completion_remote_paths.sh
A tiny implementation of bash auto completion of remote paths when using Subversion. Requires that you have a working copy and are using ^/ to indicate that it's a remote url. Add the following file and add "source ~/.svn_completion_remote_paths" to your ~/.bash_profile
#!/bin/bash
function complete_remote_paths() {
word_to_complete=${COMP_WORDS[COMP_CWORD]}
command_line=${COMP_LINE}
# If the command line contains ^/ we should start completing
if [[ "$command_line" == *^/* ]]; then
# Create a base path for svn to use which only contains complete folder
# names. Examples:
# ^/bra => ^/
@mattparrilla
mattparrilla / views.py
Last active June 12, 2016 22:13 — forked from joeydi/views.py
Form/FormSet cleaned_data handling
cleaned_data = (
[self.process_cleaned_data(form_data) for form_data in cleaned_data] if isinstanced(cleaned_data, list)
else self.process_cleaned_data(cleaned_data)
)
@mattparrilla
mattparrilla / .20230501_bashrc
Last active May 1, 2023 23:08
My local setup
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@mattparrilla
mattparrilla / index.html
Last active August 29, 2015 14:03
Small Multiples Choropleth: Lyme Disease By County in Vermont
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
margin-top: 70px;
margin-left: 25px;
}
svg {
font: 10px sans-serif;
@mattparrilla
mattparrilla / index.html
Last active August 29, 2015 14:03
Lyme Disease Cases By County
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
}
.land {
fill: white;
stroke: #bbb;
@mattparrilla
mattparrilla / ushcn2csv.py
Created April 8, 2014 20:03
Converts USHCN daily temperature data to a CSV with a row per year and date's as columns
#!/usr/local/bin/python
import csv
def date_to_winter():
f = csv.reader(open('vt-temp.csv', 'rU'))
dates = [l for l in f]
del dates[0:2]
date_row = []