Skip to content

Instantly share code, notes, and snippets.

// Euler Spiral map projection
// For https://tmcw.github.io/projectityourself/
let lon_look = [
[-180, -89.33633981999999],
[-177, -80.661710898],
[-174, -73.825305678],
[-171, -70.20639653399999],
[-167.99999999999997, -70.475119848],
@zdavkeos
zdavkeos / dot.idx
Created November 21, 2013 04:20
Simple DOT importer extension for Inkscape. Import DOT files directly into Inkscape for editing and exporting as SVG. Relies on the `dot` program for conversion.
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>DOT Input</_name>
<id>org.inkscape.input.dot</id>
<dependency type="executable" location="extensions">dot.py</dependency>
<input>
<extension>.dot</extension>
<mimetype>text/plain</mimetype>
<_filetypename>DOT (*.dot)</_filetypename>
@zdavkeos
zdavkeos / xcel_outages.geojson
Last active December 28, 2015 04:19
Python script to download and convert Xcel Energy's current outage data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zdavkeos
zdavkeos / ppsapi_client.c
Created July 6, 2013 16:51
Simple PPSAPI client for FreeBSD
// ppsapi_client.c
// Zach Davis 07-06-2013
// (C) Same license as FreeBSD
/*
* Monitors a PPS port for events
*
* See sample Makefile at the bottom
*/
@zdavkeos
zdavkeos / withcb.hs
Created May 15, 2013 03:39
Small Haskell utility that substitutes the clipboard text to another program's command line arguments. See file for usage/examples.
-- About: Run a command using the text on the clipboard.
--
-- The command line arguments form the command. If "{}" is
-- in the arguments, it is substituted with the text from the
-- clipboard, otherwise the clipboard text is appended to the end.
-- Examples:
-- copy the filename on the clipboard to the parent directory
-- > withcb cp {} ../
--
@zdavkeos
zdavkeos / clock_repair.hs
Created April 30, 2013 23:14
Haskell solution to the ACM North Central North America Regional Programming Contest Problem 5: Clock Repair
-- Problem 5: Clock Repair
--
-- November 3, 2007
-- ACM North Central North America Regional Programming Contest Problem 5
-- acm.org
--
-- Mr. Horologia's House of Clocks contains various cuckoo clocks that
-- customers have brought in for repair. Since they are in the clock
-- shop, one might rightly assume that these clocks don't quite run as
-- they should. In fact, a fast clock may take 3500 seconds to advance
@zdavkeos
zdavkeos / typing.el
Created November 13, 2012 13:42
Small update to 'Tying of Emacs' typing game, fix a small bug
;;; typing.el --- The Typing Of Emacs
;; Copyright (C) 2000, 2001 Alex Schroeder <[email protected]>
;; Zombie mode and Q&A game (c) 2011 Sacha Chua <[email protected]>
;; Author: Alex Schroeder <[email protected]>
;; Maintainer: Alex Schroeder <[email protected]>
;; Version: 1.1.4
;; Keywords: games
;; URL: http://www.geocities.com/kensanata/emacs.html
@zdavkeos
zdavkeos / self_modify.dasm
Created May 23, 2012 01:46
Example of self modifying code in Dcpu16 assembly
; Sample of self modifying code in
; (Dcpu-16) assembly. Takes advantage
; of the fact that the opcodes for
; addition and subtraction only differ
; by a single bit.
; Computes the following series:
; B = 10 + 1 - 2 + 3 - 4 + 5 ...
SET A, 1 ; initial values
SET B, 10
@zdavkeos
zdavkeos / sequence_select.py
Created October 30, 2011 22:40
Sample answer to interview question: Given an unknown number of items one at a time, choose one at random using O(1) space
#!/usr/bin/env python
from random import random
class seq_selector:
"""
Given an arbitrary and unknown length sequence of objects recieved
one at a time, this module provides a random selection from the
sequence using O(1) space.
@zdavkeos
zdavkeos / diff_region.el
Created October 12, 2011 00:21
Emacs diff-region
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; diff-region* - Diff two regions
;;
;; To compare two regions, select the first region
;; and run `diff-region`. The region is now copied
;; to a seperate diff-ing buffer. Next, navigate
;; to the next region in question (even in another file).
;; Mark the region and run `diff-region-now`, the diff
;; of the two regions will be displayed by ediff.
;;