Skip to content

Instantly share code, notes, and snippets.

@srw
srw / hnsearch.py
Created November 12, 2011 12:19
Avoiding HNSearch API limits
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Done under Visual Studio 2010 using the excelent Python Tools for Visual Studio
# http://pytools.codeplex.com/
#
# Article on ideas vs execution at: http://blog.databigbang.com/ideas-and-execution-magic-chart/
import urllib2
import json
;; image at: http://take.ms/VaXll
(def g {:a {:white :a :black :b}
:b {:white :d :black :c}
:c {:white :g :black :d}
:d {:white :c :black :e}
:e {:white :f :black :f}
:f {:white :b :black :g}
:g {:white :e :black :a}})
(defn sorted-key-list
[& maps]
(or
(->>
(mapcat keys maps)
set
(map str)
sort
(clojure.string/join ", ")
not-empty)
@jsl
jsl / clj-yaml-test.clj
Last active December 12, 2015 02:29
clj-yaml deserializes into arbitrary data types
;; Clojure library clj-yaml deserializes into arbitrary Java classes
user=> (require '[clj-yaml.core :as yaml])
nil
user=> (yaml/parse-string "!!java.io.File")
#<File >
@jcromartie
jcromartie / async_expansion.clj
Created July 13, 2013 19:35
Macro expansion of (go (+ 1 1))
;; (macroexpand-1 '(go (+ 1 1)) yields ...
(clojure.core/let
[c__2247__auto__
(clojure.core.async/chan 1)
captured-bindings__2248__auto__
(clojure.lang.Var/getThreadBindingFrame)]
(clojure.core.async.impl.dispatch/run
(clojure.core/fn
[]
/*
* call-seq:
* Rugged::Repository.new(name, options = {}) -> repository
*
* Open a Git repository with the given +name+ and return a +Repository+ object
* representing it.
*
*/
static VALUE rb_git_repo_new(int argc, VALUE *argv, VALUE klass)
{
@Vegasq
Vegasq / GetChromeRemoteCode.sh
Last active February 17, 2016 02:38
Make GoogleChrome remote key screenshot
#!/bin/bash
# GetChromeRemoteCode.sh
# Run with CRON like
# * * * * * ~/chrome_remote.sh
# Required:
# google-chrome + chrome remote desktop
# tesseract-ocr
@SalvaJ
SalvaJ / GoogleAPI.py
Last active June 7, 2016 13:47
Example making HTTP request to use Google API without api-client.It works in Python3 (tested ok in 3.3.5)
#!usr/bin/python3
# -*- coding: UTF-8 -*-
"""This module is a sample of the OAuth2 authentication by Python3"""
__version__ = "0.1.0"
__author__ = "shin (shin.hateblo.jp)"
__copyright__ = "(C) 2012 shin"
__email__ = "s2pch.luck@gmail.com"
__license__ = "Apache License 2.0"
@Smerity
Smerity / part-r-00000
Created April 6, 2014 23:38
Output from the Common Crawl HTML tag frequency count run over a single compressed 859MB WARC file
0 48
0000 6
0l 1
0xdc00 13
1 69
10 11
100 3
1001 1
100154 1
1004 1
@davidrupp
davidrupp / jetty.clj
Created October 29, 2011 03:43 — forked from minimal/jetty.clj
Websockets with clojure + jetty
;; Copyright (c) James Reeves. All rights reserved.
;; The use and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
;; can be found in the file epl-v10.html at the root of this distribution. By
;; using this software in any fashion, you are agreeing to be bound by the
;; terms of this license. You must not remove this notice, or any other, from
;; this software.
(ns compojure.server.jetty
"Clojure interface to start an embedded Jetty server."