Skip to content

Instantly share code, notes, and snippets.

View maxious's full-sized avatar
hack the planet

Alex Sadleir maxious

hack the planet
View GitHub Profile
@maxious
maxious / yourname.py
Last active May 22, 2019 04:39
Data Plumbing
NAME="yourname" # all lower case one word
import datetime
import pandas
from airflow import models
from airflow.operators.python_operator import PythonOperator
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
DATA_DIR = '/home/airflow/gcs/data/'
GCS_BUCKET = 'us-east1-dta-airflow-b3415db4-bucket'
DOCKER_IMAGE = 'gcr.io/dta-ga-bigquery/galileo'
RUN_R_SCRIPT = [('gsutil cp gs://{GCS_BUCKET}/data/{NAME}.csv . && ' +
@maxious
maxious / rc.local
Last active February 24, 2019 02:11
rc.local for booking up a Quectel GPS chip with assisted GPS data
stty -F /dev/ttyAMA0 raw speed 115200;
# clone from https://github.com/f5eng/mt3339-utils
/home/pi/mt3339-utils/gpsinit -f /home/pi/mt3339-utils/gpsinit.conf /dev/ttyAMA0 ;
if ifconfig -a | grep --quiet wlan0; then
echo wlan exists, wait to load epo;
while ! ping -c 1 -W 1 8.8.8.8; do
echo "Waiting for 8.8.8.8 - network interface might be down..."
sleep 1
done
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 7. in line 7.
Licence Number,Licensee,Weighbridge Capacity,Weighbridge Length,Main Phone ,State,Postcode,Street Address,lat,lng
PW-0401,Plumbspark Pty Ltd Trading As City Weighbridge,74,23,02 93194438,NSW,2015,33 Bourke Rd Alexandria NSW 2015 Australia,-33.914104,151.193125
PW-0449,Visa Global Logistics Pty Ltd,120,26,02 9695 3888,NSW,2019,1 Coal Pier Botany NSW 2019 Australia,-33.9451,151.199
PW-0378,Numeve Pty Ltd,60,20,02 9975 5044,NSW,2100,50 Meatworks Ave Oxford Falls NSW 2100 Australia,-33.735232,151.245816
PW-0404,Mitch Bastaja Trading As Enfield Public Weighbridge,50,16,02 9742 3382,NSW,2136,74 Cosgrove Rd Strathfield South NSW 2136 Australia,-33.890197,151.073095
PW-0126,Sydney Markets Limited T/A Sydney Markets Public Weighbridge,90,27,02 9325 6173,NSW,2140,Parramatta Rd Homebush West NSW 2140 Australia,-33.859837,151.071293
PW-0010,Sydney Weighbridges Auburn,140,27,02 9748 2391,NSW,2144,6 Rawson Rd Auburn NSW 2144 Australia,-33.851528,151.037279
PW-0011,Sydney Weighbridges Smithfield,120,27,02 9604 2677,NSW,216
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------- #
import os, threading, re, sys, time, math, unicodedata
from collections import deque
# import non-standard libraries
for libraryName in ['dothat','dothat.lcd','dothat.backlight']:
try:
{
"version": "10.2.1.42",
"systemMessages": [],
"locations": [
{
"id": "10111079",
"name": "Pitt St opp Australia Square, Sydney",
"disassembledName": "Pitt St opp Australia Square",
"coord": [
-33.86462,
02:55:32,526 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
02:55:32,528 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
02:55:32,528 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/app/lib/au.csiro.data61.magda-indexer-0.0.49-RC3.jar!/logback.xml]
02:55:32,529 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
02:55:32,529 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/app/lib/au.csiro.data61.magda-scala-common-0.0.49-RC3.jar!/logback.xml]
02:55:32,529 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/app/lib/au.csiro.data61.magda-indexer-0.0.49-RC3.jar!/logback.xml]
02:55:32,627 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@6f8e8894 - URL [jar:file:/app/lib/au.c
Timestamp Applications Saved Applications Submitted Applications Assessed Applications Approved
1/1/2017 0:00:00 10 0 0 0
1/2/2017 0:00:00 15 5 0 0
1/3/2017 0:00:00 20 10 3 0
1/4/2017 0:00:00 25 15 6 4
1/5/2017 0:00:00 30 20 9 8
1/6/2017 0:00:00 35 25 12 12
1/7/2017 0:00:00 40 30 18 16
1/8/2017 0:00:00 45 35 22 20
1/9/2017 0:00:00 50 40 26 24
[
{
"userName": "ausdto",
"repo": "dto-digitalmarketplace-utils"
},
{
"userName": "ausdto",
"repo": "dto-digitalmarketplace-frontend"
},
{
We can't make this file beautiful and searchable because it's too large.
X,Y,species,feat_cent_east,feat_cent_north,field_4
151.200167543188769,-33.886139639917495,Tristaniopsis laurina,333557.5,6249010.68,
151.200165820644742,-33.886247372565414,Populus simonii,333557.55,6248998.73,
151.200063469032415,-33.886070488745034,Sapium sebiferum,333547.74,6249018.18,
151.200056485016063,-33.886140451814697,Sapium sebiferum,333547.23,6249010.41,
151.200054514520104,-33.886270273441475,Sapium sebiferum,333547.3,6248996.01,
151.211861147131685,-33.867811513042298,Platanus acerifolia,334603.65,6251062.09,
151.211958805174987,-33.8678145534466,Platanus acerifolia,334612.69,6251061.91,
151.212065762566766,-33.867817458196136,Platanus acerifolia,334622.59,6251061.76,
151.211860536267523,-33.867939281255886,Platanus acerifolia,334603.84,6251047.92,
SSC_NAME X Y
Abbey 115.2563544 -33.66364144
Abbotsbury 150.8611863 -33.87010264
Abbotsford (NSW) 151.1292403 -33.8506086
Abbotsford (Vic.) 144.9997617 -37.804598
Abercrombie 149.545803 -33.38867177
Aberdare 151.3733625 -32.84196638
Aberdeen (NSW) 150.7932437 -32.14881923
Aberdeen (Tas.) 146.3166725 -41.2381526
Aberfeldie 144.8973979 -37.75958892