Skip to content

Instantly share code, notes, and snippets.

View dsedivec's full-sized avatar

Dale Sedivec dsedivec

View GitHub Profile
@dsedivec
dsedivec / flycheck-ruff.el
Last active July 10, 2024 07:09 — forked from abo-abo/flycheck-ruff.el
Emacs ruff flycheck config
(require 'flycheck)
;; From https://github.com/flycheck/flycheck/issues/1974#issuecomment-1343495202
(flycheck-define-checker python-ruff
"A Python syntax and style checker using the ruff utility.
To override the path to the ruff executable, set
`flycheck-python-ruff-executable'.
See URL `http://pypi.python.org/pypi/ruff'."
:command ("ruff"
"check"
;; 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 August 29, 2015 13:57
vimkill command: pgrep + vim + kill
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
#!/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 March 22, 2012 00:17
Make simple CREATE TABLE from the first line of a tab-delimited data file
# 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 January 5, 2011 05:03
use with :as and :only
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
\documentclass{article}
\usepackage{tabularx}
\newenvironment{tableenv}[0]{%
\tabularx{1\linewidth}{|l|X|}%
}{%
\endtabularx%
}
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).
print "hello world"
import java.util.HashMap;
public class EmptyCollectionMap extends HashMap {
Class collectionType;
public EmptyCollectionMap(Class collectionType) {
super();
this.collectionType = collectionType;
}