Skip to content

Instantly share code, notes, and snippets.

View 1012's full-sized avatar

Margarita Mayoral Villa 1012

View GitHub Profile
@1012
1012 / overpass.geojson
Created September 6, 2016 12:33 — forked from anonymous/overpass.geojson
data exported by overpass turbo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@1012
1012 / jsonval.sh
Created September 6, 2016 12:06 — forked from cjus/jsonval.sh
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@1012
1012 / cmdline.clj
Last active March 8, 2016 18:22 — forked from rippinrobr/cmdline.clj
the hugo project's cmdline.clj file - used allow me to run the app from the cmd line
(ns cmdline
(:gen-class)
(:use hugo.parser)
(:use hugo.text-formatting))
(def *base-url* "http://www.thehugoawards.org/hugo-history/")
(defn prep-for-file
"Formats the output so it can be written correctly to the output file"
[rec]
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join