Skip to content

Instantly share code, notes, and snippets.

Dale Sedivec dsedivec

  • Chicago, IL
Block or report user

Report or block dsedivec

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
;; http://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html.
;; 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
dsedivec / vimkill.sh
Last active Aug 29, 2015
vimkill command: pgrep + vim + kill
View vimkill.sh
vimkill () {
local temp_file
temp_file=$(mktemp -t vimkillXXXXXXXXXX)
if [ $? -ne 0 ]; then
echo "mktemp failed" >&2
return 1
fi
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
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 yourscript.py 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 = csv_file_obj.next()
# 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
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
nil
user=> replace
#<string$replace clojure.string$replace@4245c97b>
user=> split
View scratch.tex
\documentclass{article}
\usepackage{tabularx}
\newenvironment{tableenv}[0]{%
\tabularx{1\linewidth}{|l|X|}%
}{%
\endtabularx%
}
View README
In one window:
$ python2.6 /tmp/wsgiexample.py
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) {
super();
this.collectionType = collectionType;
}
@dsedivec
dsedivec / gist:199309
Created Oct 1, 2009
Example of using c.c.zip-filter.xml
View gist:199309
(require '[clojure.xml :as xml]
'[clojure.zip :as zip]
'[clojure.contrib.zip-filter.xml :as zfx])
(def reddit-rss-xml (xml/parse "http://www.reddit.com/.rss"))
(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.