Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile
@radu-gheorghe
radu-gheorghe / copy_es_index.bash
Created November 5, 2012 09:30
copy one Elasticesarch index to another
#!/bin/bash
CURRENTINDEX="test"
NEWINDEX="newindex"
#where the indices are stored within the DATADIR
INDICESDIR=/var/lib/elasticsearch/elasticsearch/nodes/0/indices/
#get the metadata for the current index
curl localhost:9200/$CURRENTINDEX/_settings?pretty=true > /tmp/settings
curl localhost:9200/$CURRENTINDEX/_mapping?pretty=true > /tmp/mappings
(ns plumbing.graph-async
(:require
[plumbing.fnk.pfnk :as pfnk]
[plumbing.fnk.schema :as schema]
[plumbing.core :as plumbing]
[plumbing.graph :as graph]))
;; async function has ^:async metadata, callback required key.
;; TODO: redo with just promises/futures once they have callback options
;; TODO: make nicer way to specify async fnks?
anonymous
anonymous / nn.clj
Created March 24, 2013 16:55
A neural network in Titan and Clojure implementing the xor function
(ns martha.core
(:require [clojurewerkz.titanium.graph :as g]
[clojurewerkz.titanium.vertices :as v]
[clojurewerkz.titanium.edges :as e]
[clojurewerkz.titanium.types :as t]
[ogre.core :as q]))
(def conf {:storage {:backend "embeddedcassandra"
:hostname "127.0.0.1"
:keyspace "martha"
(ns react-cljs.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [om.core :as om]
[om.dom :as dom :include-macros true]
[cljs.core.async :refer [>! <! chan put! sliding-buffer]]))
(enable-console-print!)
(def app-state
(atom {:counters (into [] (map (fn [n] {:id n :count 0}) (range 10)))}))
@mbbx6spp
mbbx6spp / Vagrantfile.rb
Created February 5, 2011 05:36
Riak cluster Vagrantfile to offer an alternative to Basho Chef+Vagrant blog post suggestion and receive feedback at http://blog.basho.com/2011/02/04/creating-a-local-riak-cluster-with-vagrant-and-chef/
# Offering alternative Chef + Vagrant Riak cluster setup to the following blog post at basho:
# http://blog.basho.com/2011/02/04/creating-a-local-riak-cluster-with-vagrant-and-chef/
# Assumes Vagrant 0.7.0+ and VirtualBox 4.0+
# Now you should be able to launch your X (where X=4 in this case) vagrant VMs with the following:
# % vagrant up db1
# % vagrant up db2
# % vagrant up db3
# % vagrant up db4
@puffnfresh
puffnfresh / hipchat.el
Created November 2, 2012 15:34
HipChat + jabber.el
;; Connect using jabber-connect
;; My username from the HipChat configuration
;; from https://www.hipchat.com/account/xmpp
(setq jabber-account-list '(("10804_81219@chat.hipchat.com")))
;; To join HipChat rooms easily
(defvar hipchat-number "10804")
(defvar hipchat-nickname "Brian McKenna")
(defun hipchat-join (room)
@trey
trey / dropbox_git.md
Created May 18, 2012 03:12
Using Dropbox to Share Git Repositories

Using Dropbox to Share Git Repositories

First, create a Git subfolder inside your Dropbox folder. Then you can share the individual projects inside that folder with whomever you want (or just use it for instant offsite backups).

From inside a Git project:

git clone --bare . ~/Dropbox/Git/gitproject.git
git remote add dropbox ~/Dropbox/Git/gitproject.git

When you're ready to push:

@darkone23
darkone23 / net.cljs
Last active May 11, 2021 12:12
websocket as a cljs core.async channel
(ns example.net
(:require [goog.net.WebSocket]
[goog.events :refer (listen)]
[cljs.core.async :as async :refer (chan <! >! put! close)]
[cljs.core.async.impl.protocols :as proto])
(:require-macros [cljs.core.async.macros :refer (go)]))
(defn ws
"WebSocket as a core.async channel
returns a channel which delivers the ws chan then closes"
@jneira
jneira / express-sample.cljs
Created August 25, 2011 20:07
Clojurescript / node.js basic examples
(ns express_sample
(:require [cljs.nodejs :as node]))
(def express (node/require "express"))
(def app (. express (createServer)))
(defn -main [& args]
(doto app
(.use (. express (logger)))
(.get "/" (fn [req res]
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;