Skip to content

Instantly share code, notes, and snippets.

@subfuzion
subfuzion / curl.md
Last active May 3, 2024 09:26
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

#!/bin/bash
# rename TMS tiles to the XYZ schema
# no quoting, since all files have simple numeric names
# do not run this anywhere else than INSIDE your tiles directory
# run it like this: find . -name "*.png" -exec ./tms2xyz.sh {} \;
filename=$1
tmp=${filename#*/} # remove to first /
@zkiraly
zkiraly / procedure-to-archive-git-branches.md
Last active April 5, 2024 20:09
Procedure to archive git branches.
@dwtkns
dwtkns / snippet.js
Created November 20, 2013 18:47
Snippet to paste into console to load d3 onto a page
var s=document.createElement('script'); s.type='text/javascript'; s.src='http://d3js.org/d3.v3.min.js'; document.head.appendChild(s);
@benbalter
benbalter / geojson-conversion.sh
Last active April 23, 2024 13:16
Bulk convert shapefiles to geojson using ogr2ogr
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
@sandsfish
sandsfish / getMARCField Example.r
Created February 12, 2013 18:54
R function to parse out list of specific field/sub-field from MARC/XML
library(XML)
getMARCField = function(marc_doc, tag, code) {
xpath = paste("/m:collection/m:record/m:datafield[@tag='", tag, "']/m:subfield[@code='", code, "']", sep="")
return(xpathApply(marc_doc, xpath, namespaces=c("m"), xmlValue))
}
vs = xmlRoot(xmlParse('vail-first-3500.xml'))
field100a = getMARCField(vs, '100', 'a')
brew install ffmpeg --with-libvorbis --with-nonfree --with-gpl --with-libvpx --with-pthreads --with-libx264 --with-libfaac --with-libtheora
@jlewin
jlewin / readme.md
Last active December 10, 2015 20:58 — forked from johan/readme.md
**Fork Details** A quick and dirty update to refactor for the December 2012 site changes and well as account for the use of pjax, which happens to bypass userscript invocation for all urls except on page reloads. As such, a MutationObserver is registered to identify when pjax requests reload the #js-pjax-container and button injection logic is r…
@sandys
sandys / table_to_csv.rb
Created October 18, 2012 10:04
convert a html table to CSV using ruby
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb```
require 'rubygems'
require 'nokogiri'
require 'csv'
f = File.open("/tmp/preview.html")
doc = Nokogiri::HTML(f)
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true})
@mbostock
mbostock / .block
Last active August 5, 2023 12:53
Margin Convention
license: gpl-3.0
redirect: https://observablehq.com/@d3/margin-convention