Skip to content

Instantly share code, notes, and snippets.

View vizanto's full-sized avatar

Danny Wilson vizanto

View GitHub Profile
@Chouser
Chouser / message-map.clj
Created February 24, 2010 19:02
leveraging call-site caching for getter access
(defn message-map [msg1]
(reify
clojure.lang.IDeref
(deref [] msg1)
clojure.lang.IKeywordLookup
(getLookupThunk [k]
(let [getter (->> (name k)
(replace-by #"(?:^|-)(.)" #(.toUpperCase (nth % 1)))
(str "get")
symbol)
@davidsantiago
davidsantiago / gist:926154
Created April 18, 2011 20:55
SSH Port forwarding in Pallet!
(defmacro with-ssh-tunnel->
"Execute the body with an ssh-tunnel available for the ports given in the
tunnels map. tunnels should be a map from local ports (integers) to either
1) An integer remote port. Remote host is assumed to be 'localhost'.
2) A vector of remote host and remote port. eg, [\"yahoo.com\" 80].
Automatically closes the connection (and port forwards) on completion."
[request tunnels & body]
`(clj-ssh/with-ssh-agent [(execute/default-agent)]
(let [user# (:user ~request)
node-address# (compute/node-address (:target-node ~request))
@jdonaldson
jdonaldson / JsonHxDef.hx
Created December 10, 2011 01:54
jsonhxdef is a ruby script that helps you quickly define a typedef from some arbitary json
typedef JsonObj = {
glossary:Glossary,
}
typedef Glossary = {
title:String,
GlossDiv:GlossDiv,
}
typedef GlossDiv = {
@lambder
lambder / extend-array-type.clj
Created December 22, 2011 12:15
Example of extending native Java array types to Clojure protocols
; Copyright (c) Daniel Kwiecinski. 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.
;
; Example of extending native Java array types to Clojure protocols
@sasha-id
sasha-id / README
Created March 23, 2012 15:03
MongoDB multiple instance upstart scripts: mongodb, mongod --configsvr and mongos
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@viktorklang
viktorklang / swingactors.scala
Created April 19, 2012 17:25
Swing Actors using Akka
// ©2012 Viktor Klang
package akka.klang
import akka.dispatch.{ DispatcherPrerequisites, ExecutorServiceFactory, ExecutorServiceConfigurator }
import com.typesafe.config.Config
import java.util.concurrent.{ ExecutorService, AbstractExecutorService, ThreadFactory, TimeUnit }
import java.util.Collections
import javax.swing.SwingUtilities
@hemanth
hemanth / webdev.md
Created June 9, 2012 03:00 — forked from dideler/bootstrapping.md
Bootstrapping
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active November 14, 2024 17:18
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@Simn
Simn / Main.hx
Last active February 22, 2021 09:51
New reification examples
class Main {
static function main() {
MyMacro.testReify();
}
}