This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn assoc-some [m & kvs] | |
(if-not (even? (count kvs)) | |
(throw (IllegalArgumentException. "even number of key-values required.")) | |
(if-let [kvs (not-empty (filter #(some? (second %)) (partition 2 kvs)))] | |
(apply assoc m (flatten kvs)) | |
m))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sel=geany.selection() | |
geany.launch('rxvt-unicode', '-e', 'man','2', sel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
import urllib.parse | |
import http.client | |
import html.parser | |
from datetime import datetime | |
def get_seat_status(location, month): | |
""" get free seat status for given location(Beijing) and month(201104) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YAHOO_PIPE_URL = "http://pipes.yahoo.com/pipes/pipe.run?_id=7NxhUNSA3RG_BCC6BBNMsA&_render=json"; | |
function lifeStreamCallback(stream){ | |
var lifeStreamRootDom = document.getElementById("lifestream"); | |
try{ | |
lifeStreamRootDom.removeChild(lifeStreamRootDom.getElementsByTagName("ul")[0]); | |
}catch(e) {} | |
var lifeStreamListDom = document.createElement("ul"); | |
for(var i=0; i<stream.count; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# usage, convert this work method to a Runnable anonymous class | |
# | |
# @anonymous_class(Runnable, 'run') | |
# def work(dummy): | |
# print 'hello world' | |
# | |
# work.run() | |
# | |
import types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# conky configuration | |
# edited by darcon@gmail.com | |
# set to yes if you want Conky to be forked in the background | |
background no | |
# X font when Xft is disabled, you can pick one with program xfontsel | |
#font 5x7 | |
#font 6x10 | |
#font 7x13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns reddit-visualization.core | |
(:require [reddit.clj.core :as reddit]) | |
(:import [javax.swing JFrame]) | |
(:import [org.jfree.chart ChartFactory ChartPanel]) | |
(:import [org.jfree.data.general DefaultPieDataset]) | |
(:import [org.jfree.util SortOrder])) | |
(def reddit-client (reddit/login nil nil)) | |
(defn map-reddits [user after-id] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns reddit-visualization.core | |
(:refer-clojure :exclude [replace]) | |
(:use [clojure.pprint]) | |
(:use [clojure.string :only [lower-case replace split]]) | |
(:require [clojure.java.jdbc :as jdbc]) | |
(:require [reddit.clj.core :as reddit]) | |
(:import [javax.swing JFrame]) | |
(:import [org.jfree.chart ChartFactory ChartPanel]) | |
(:import [org.jfree.data.general DefaultPieDataset]) | |
(:import [org.jfree.util SortOrder])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gen-class-test.imgscale | |
(:use [clojure.java.io]) | |
(:import [javax.imageio ImageIO]) | |
(:import [com.mortennobel.imagescaling ResampleOp ResampleFilters])) | |
(defn read-img [path] | |
(ImageIO/read (file path))) | |
(defn write-img [img path] | |
(ImageIO/write img "jpg" (file path))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns slackerbench.core | |
(:use [slacker.client]) | |
(:import [java.util.concurrent Executors TimeUnit]) | |
(:gen-class)) | |
(defn -main [& args] | |
(def host (first args)) | |
(def total-connections (Integer/valueOf (nth args 2))) | |
(def scp (slackerc-pool host 2104 |
OlderNewer