This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://data.bionet.nsw.gov.au/biosvcapp/odata/SpeciesNames > SpeciesNames.json | |
cat SpeciesNames.json | jq -r '(.value|map(keys)|add|unique) as $cols | (.value | map(. as $row | $cols | map($row[.]))) as $rows | $cols, $rows[] | @csv' > SpeciesNames.csv | |
echo '.mode csv | |
.import SpeciesNames.csv spname' | sqlite3 spname.sqlite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
import kotlin.collections.ArrayList | |
import kotlin.collections.HashMap | |
abstract class Diff { | |
sealed class Op<T> { | |
data class Insert<T>(val index: Int, val value: T) : Op<T>() | |
data class Delete<T>(val index: Int) : Op<T>() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Protocol-based approach | |
protocol JSONValue {} | |
extension Int: JSONValue {} | |
extension String: JSONValue {} | |
extension Bool: JSONValue {} | |
extension Double: JSONValue {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Zero-dependencies drag zoom control | |
function dragZoomControl(map) { | |
var drawingManager = new google.maps.drawing.DrawingManager(); | |
drawingManager.setOptions({ | |
drawingMode : google.maps.drawing.OverlayType.RECTANGLE, | |
drawingControl : false, | |
rectangleOptions : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::prelude::*; | |
// Feedback welcome | |
fn pipe(source: &mut Read, dest: &mut Write) -> std::io::Result<usize> { | |
let mut buf = [0; 512]; | |
let mut bytes_read: usize = 0; | |
let mut bytes_written: usize = 0; | |
let mut total_bytes: usize = 0; | |
loop { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
import unicodedata | |
class InsertSpecialSymbolCommand(sublime_plugin.TextCommand): | |
DEBUG = True | |
replacements = dict((unicodedata.name(L).split()[-1].lower(), L) for L in map(unichr, range(945, 970))) | |
@staticmethod | |
def debug(string): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=2.5, maximum-scale=2.5, minimum-scale=2.5, width=device-width, user-scalable=no" /> | |
</head> | |
<body> | |
<div style="width: 100px; height: 100px; background: red;">Hello World</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
input= | |
while true | |
do | |
input="$(/usr/bin/osascript 2>/dev/null <<-__HEREDOC__ | |
with timeout of 300 seconds | |
tell application "System Events" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Description: WKT Grammar | |
* | |
* Based on OGC document 06-103r4: | |
* OpenGIS Implementation Standard for Geographic information | |
* - Simple feature access | |
* - Part 1: Common architecture (Version 1.2.1) | |
* | |
* Copyright (c) 2011 James Watmuff | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
parent=$(pwd) | |
for dir in proj1 \ | |
proj2 \ | |
proj3 | |
do | |
pushd $dir && mvn $@ | tee $parent/mvn-out && expr $PIPESTATUS = 0 && popd || break | |
done | |
osascript -e 'tell app "System Events" to activate' |
NewerOlder