Skip to content

Instantly share code, notes, and snippets.

@oeon
oeon / base64-encode-decode.js
Created August 23, 2016 17:35 — forked from JavaScript-Packer/base64-encode-decode.js
Perfect ATOB/BTOA alternatives (Base64 encoder/decoder) for JavaScript/Jscript.net Demo on http://jsfiddle.net/1okoy0r0/
function b2a(a) {
var c, d, e, f, g, h, i, j, o, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", k = 0, l = 0, m = "", n = [];
if (!a) return a;
do c = a.charCodeAt(k++), d = a.charCodeAt(k++), e = a.charCodeAt(k++), j = c << 16 | d << 8 | e,
f = 63 & j >> 18, g = 63 & j >> 12, h = 63 & j >> 6, i = 63 & j, n[l++] = b.charAt(f) + b.charAt(g) + b.charAt(h) + b.charAt(i); while (k < a.length);
return m = n.join(""), o = a.length % 3, (o ? m.slice(0, o - 3) :m) + "===".slice(o || 3);
}
function a2b(a) {
var b, c, d, e = {}, f = 0, g = 0, h = "", i = String.fromCharCode, j = a.length;
@oeon
oeon / fulcrum-report-rename.sh
Last active August 14, 2020 01:27 — forked from bmcbride/fulcrum-report-rename.sh
Fulcrum PDF reports are named with the record's unique fulcrum_id. This bash script loops through the parent CSV file and renames the PDF files based on the index of user-specified fields.
#!/bin/bash
INPUT=fire_hydrants.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read -a csv_line
do
mv ${csv_line[0]}.pdf ${csv_line[8]}-${csv_line[0]}.pdf
done < $INPUT
@oeon
oeon / Code.gs
Last active April 13, 2018 00:09 — forked from bmcbride/Code.gs
Google Apps Script for exporting CSV files and photos from the Fulcrum Query API to a Drive folder
/**
Title: Google Apps Script for exporting CSV files from the Fulcrum Query API to a Drive folder
Notes: Be sure to manually run the exportData() function at least once to authorize the script. Set a timed trigger to automate exports.
Author: Bryan R. McBride
Contributor: Joe Larson, exportPhotos()
**/
var fulcrumToken = "abcdefghijklmnopqrstuvwxyz";
var fulcrumFormName = "My App";
var filesFolder = "1ByvB7rSq_Pi2AE_JvqRFm6zUETbdJ8dG";
@oeon
oeon / fulcrum_download_timedatestamp.py
Last active May 11, 2016 17:54 — forked from bmcbride/fulcrum_download.py
Python script for fetching a Fulcrum data share and saving it locally with a date & time stamp.
import urllib2
import datetime
def timeStamped(fname, fmt='%Y-%m-%d-%H-%M-%S_{fname}'):
return datetime.datetime.now().strftime(fmt).format(fname=fname)
url = 'https://web.fulcrumapp.com/shares/6e158acd08cacfad.csv'
u = urllib2.urlopen(url)
localFile = open('fulcrum_data.csv', 'w')
localFile.write(u.read())
localFile.close()
with open(timeStamped('fulcrum_data.csv'),'w') as outf:
@oeon
oeon / map.geojson
Created August 14, 2013 23:08 — forked from anonymous/map.geojson
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oeon
oeon / map.geojson
Created August 14, 2013 21:35 — forked from anonymous/map.geojson
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oeon
oeon / map.geojson
Created August 13, 2013 16:57 — forked from anonymous/map.geojson
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oeon
oeon / qgis_libs.sh
Created February 12, 2013 05:25 — forked from bmount/qgis_libs.sh
sudo mkdir -p /Library/Frameworks/GDAL.framework/Versions/1.9/
sudo ln -s /usr/local/lib/libgdal.dylib /Library/Frameworks/GDAL.framework/Versions/1.9/GDAL
sudo mkdir -p /Library/Frameworks/PROJ.framework/Versions/4/
sudo ln -s /usr/local/Cellar/proj/4.8.0/lib/libproj.dylib /Library/Frameworks/PROJ.framework/Versions/4/PROJ
# did not work: sudo ln -s `pwd`/libgeos.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
# did work:
# $PWD is /usr/local/Cellar/geos/3.3.6/lib
sudo ln -s `pwd`/libgeos_c.1.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
sudo mkdir -p /Library/Frameworks/SQLite3.framework/Versions/3/
sudo ln -s /usr/local/Cellar/sqlite/3.7.15/lib/libsqlite3.0.8.6.dylib /Library/Frameworks/SQLite3.framework/Versions/3/SQLite3
@oeon
oeon / Ubuntu s3fs install
Created November 1, 2012 20:53 — forked from matthewhudson/Ubuntu s3fs install
Ubuntu s3fs install & dependencies.
# Install prerequisites before compiling:
apt-get install build-essential
apt-get install libfuse-dev
apt-get install fuse-utils
apt-get install libcurl4-openssl-dev
apt-get install libxml2-dev
apt-get install mime-support
# Download and Install
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
@oeon
oeon / gist:3040136
Created July 3, 2012 14:39 — forked from zhm/gist:2005091
gdal configure
./configure \
--with-local=yes \
--prefix=/usr/local/gdal191 \
--with-threads \
--with-libtool \
--with-libtiff=internal \
--with-geotiff=internal \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-bsb \