Skip to content

Instantly share code, notes, and snippets.

View Tafkas's full-sized avatar

Christian Stade-Schuldt Tafkas

View GitHub Profile
@mroderick
mroderick / stringify-tip.js
Created April 15, 2015 10:20
Readable output from JSON.stringify
var o = {hello:'world', greetings: ['one', 'two', 'three']};
undefined
// regular, difficult to read for large objects
JSON.stringify(o);
"{"hello":"world","greetings":["one","two","three"]}"
// presto!
JSON.stringify(o, '', ' ');
"{
@ejain
ejain / build.g
Created November 15, 2013 06:03
Converts a directory of GPX files into a single KML file for import into Google Fusion Tables; includes some metadata based on the file name.
import groovy.xml.MarkupBuilder
new MarkupBuilder().kml(xmlns : 'http://www.opengis.net/kml/2.2') {
new File(args?.size() ? args[0] : '.').eachFileMatch(~/.*\.gpx/) { file ->
new XmlParser().parse(file).trk.each { trk ->
trk.trkseg.each { trkseg ->
def geo = ""
trkseg.trkpt.each { trkpt ->
geo += "${trkpt.'@lon'},${trkpt.'@lat'}\n"
}
#!/usr/bin/env bash
#Code adapted from https://gist.github.com/yangj1e/3641843c758201ebbc6c (Modified to Python3.5)
cd ~
#wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.1-Linux-x86_64.sh
bash Anaconda3-2.4.1-Linux-x86_64.sh -b
echo 'PATH="/home/ubuntu/anaconda3/bin:$PATH"' >> .bashrc
. .bashrc
@adrianseeley
adrianseeley / gnn.iris.js
Last active November 9, 2017 06:42
Code Used To Generate: Neural Genetic Adaptation of the Iris Dataset (GATO-2014)
function gnn (cases, wide, tall, population, iterations, error_fn, error_thresh) {
var inputs = cases[0][0].length;
var outputs = cases[0][1].length;
// declare net, provide input layer
var net = [new Array(inputs)];
// create input neurons in input layer
for (var i = 0; i < inputs; i++)
net[0][i] = {output: 0}
// create hidden layers
for (var x = 0; x < wide; x++) {
@johnschrom
johnschrom / gist:8638763
Last active January 5, 2021 21:20
Making a map of foursquare checkins
library(ggplot2)
library(maps)
library(mapproj)
###############################################################################
# Step 1: Get data from Foursquare
# If you already have it, then great :) Otherwise, you can use RPI. The source
# is listed below, and there are instructions for getting keys in the readme.
# RPI: https://github.com/johnschrom/RPI
# ~/.gitconfig from @boblet
# initially based on http://rails.wincent.com/wiki/Git_quickstart
[core]
excludesfile = /Users/oli/.gitignore
legacyheaders = false # >git 1.5
quotepath = false
# http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
pager = less -r
# if ↑ doesn’t work, try: pager = less -+$LESS -FRX
@dbreunig
dbreunig / ReporterSaveFileDescription.md
Last active January 22, 2021 16:07
A description of the data written to the Reporter App Dropbox save folder.

#Reporter Save File Schema

##The Reporter Export File

Reporter saves to your Dropbox account with plaintext JSON files, one for each day. When a Report is entered in the app a file is created for that day if it does not exist. Otherwise, the report is appended to the existing file. The save folder is located in 'Dropbox/Apps/Reporter-App/'.

Reporter save files are named according to the following convention:

YYYY-MM-DD-reporter-export.json
@entaq
entaq / Google_oAuth.js
Created November 15, 2012 17:18
Google oAuth 2.0 sample
/**
reference -
https://developers.google.com/accounts/docs/OAuth2WebServer
https://code.google.com/apis/console/
https://developers.google.com/+/api/latest/
**/
////handle all requests here
function doGet(e) {
@anarchivist
anarchivist / slack_munin.sh
Last active May 3, 2022 19:21
Slack notification script for Munin
#!/bin/bash
# Slack notification script for Munin
# Mark Matienzo (@anarchivist)
#
# To use:
# 1) Create a new incoming webhook for Slack
# 2) Edit the configuration variables that start with "SLACK_" below
# 3) Add the following to your munin configuration:
#
@dannguyen
dannguyen / iowa-liquor-sales-dataset.readme.md
Last active July 8, 2023 12:27
Cleaning, summing up the State of Iowa Liquor Sales dataset

Iowa Liquor Sales dataset via Socrata/data.iowa.gov

(preliminary exploration)

The state of Iowa has released an 800MB+ dataset of more than 3 million rows showing weekly liquor sales, broken down by liquor category, vendor, and product name, e.g. STRAIGHT BOURBON WHISKIES, Jim Beam Brands, Maker's Mark

This dataset contains the spirits purchase information of Iowa Class “E” liquor licensees by product and date of purchase from January 1, 2014 to current. The dataset can be used to analyze total spirits sales in Iowa of individual products at the store level.

You can view the dataset via Socrata