Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jxa on github.
  • I am xandrews (https://keybase.io/xandrews) on keybase.
  • I have a public key whose fingerprint is 1C77 913C 93DC 9D55 0730 D7C5 E0D2 D073 C529 1572

To claim this, I am signing this object:

@jxa
jxa / core.clj
Created July 9, 2013 19:40
distance algorithm for Lambda Jam
(ns digits.core
(:require
[clojure.string :as str]
[clojure.java.io :refer [resource reader]]
[clojure.core.reducers :as r]))
(defn train [reader]
(map (fn [line]
(map #(Integer/parseInt %) (str/split line #",")))
@jxa
jxa / user.clj
Created January 2, 2012 17:57
REPL tools for looking up docs and listing an object's methods. Put this file in ~/.lein
(use 'clojure.repl)
(use 'clojure.java.javadoc)
(use '[clojure.reflect :only [reflect]])
(use '[clojure.string :only [join]])
(defn inspect [obj]
"nicer output for reflecting on an object's methods"
(let [reflection (reflect obj)
members (sort-by :name (:members reflection))]
(println "Class:" (.getClass obj))
@jxa
jxa / repl_session.txt
Created February 16, 2011 23:05
can't assign to an existing context property in REPL?
$ node ./test.js
> setContext('sup', 'yo')
> sup
'yo'
> setContext('sup', 'what?')
> sup
'yo'
>
CmdUtils.makeSearchCommand(
{ name: "Pollstar",
synonyms: ["concert", "music", "pst"],
url: "http://www.pollstar.com/eventSearch.aspx?SearchBy={QUERY}",
icon: "http://www.pollstar.com/favicon.ico",
description: "Searches Pollstar for shows near you, or artists on tour."});
(require 'anything)
(require 'anything-config)
(setq anything-sources
(list anything-c-source-buffers
anything-c-source-file-name-history
anything-c-source-man-pages
anything-c-source-emacs-commands))
sudo apt-get install mysql-server
# drop anonymous user
shell> mysql -u root
mysql> DROP USER '';
# set root passwd
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
-> WHERE User = 'root';
mysql> FLUSH PRIVILEGES;
CREATE_DATABASE my_super_db DEFAULT CHARSET utf8;