Skip to content

Instantly share code, notes, and snippets.

Dale Sedivec dsedivec

  • Chicago, IL
View GitHub Profile
View comment-sexp.el
;; The desire for this is obvious once you use comment-dwim-2, but the
;; implementation ideas come from a comment by Fuco1 (author of
;; smartparens AFAIK) on
;; Artur's code there breaks on uncommenting when there's a nearby
;; string with ";" in it, e.g. (untested simplified test case for the
;; problem I experienced):
;; (define-key blah "M-;" #'foo)
dsedivec /
Last active Aug 29, 2015
vimkill command: pgrep + vim + kill
vimkill () {
local temp_file
temp_file=$(mktemp -t vimkillXXXXXXXXXX)
if [ $? -ne 0 ]; then
echo "mktemp failed" >&2
return 1
if ! pgrep -fl "$@" > "$temp_file"; then
rm "$temp_file"
echo "no matching processes found" >&2
View highcat
#!/usr/bin/env python
import sys
import re
import argparse
CSI = "\033["
RESET = CSI + "0m"
COLORS = dict((name, value) for value, name
dsedivec / gist:2154361
Created Mar 22, 2012
Make simple CREATE TABLE from the first line of a tab-delimited data file
View gist:2154361
# Put this in a file and run it like "python name_of_your_file.csv".
import sys
import csv
csv_file_obj = csv.reader(open(sys.argv[1], "rb"), dialect=csv.excel_tab)
first_row =
# first_row is now a list of column names, we hope. Feel free to print it out.
print "CREATE TABLE tablename (%s);" % (", ".join("%s TEXT" % (name,) for name in first_row),)
dsedivec / gist:765957
Created Jan 5, 2011
use with :as and :only
View gist:765957
user=> replace
#<core$replace clojure.core$replace@175bc6c8>
user=> split
java.lang.Exception: Unable to resolve symbol: split in this context (NO_SOURCE_FILE:0)
user=> (use '[clojure.string :as s :only (replace split)])
WARNING: replace already refers to: #'clojure.core/replace in namespace: user, being replaced by: #'clojure.string/replace
user=> replace
#<string$replace clojure.string$replace@4245c97b>
user=> split
View scratch.tex
In one window:
$ python2.6 /tmp/
In another:
$ curl http://localhost:9977
POST some text to me.
$ curl -d 'This is xxx a test.' http://localhost:9977
I found 3 X(es).
View gist:283094
import java.util.HashMap;
public class EmptyCollectionMap extends HashMap {
Class collectionType;
public EmptyCollectionMap(Class collectionType) {
this.collectionType = collectionType;
dsedivec / gist:199309
Created Oct 1, 2009
Example of using
View gist:199309
(require '[clojure.xml :as xml]
'[ :as zip]
'[ :as zfx])
(def reddit-rss-xml (xml/parse ""))
(def zipped-xml (zip/xml-zip reddit-rss-xml))
;; xml1-> treats keywords as "search for this tag." xml/node at the
;; end says "return me that one part of the XML map" (format specified
You can’t perform that action at this time.