Skip to content

Instantly share code, notes, and snippets.

View cmeiklejohn's full-sized avatar
💭
Always working.

Christopher S. Meiklejohn cmeiklejohn

💭
Always working.
View GitHub Profile
@al3xandru
al3xandru / gist:7283595
Last active December 27, 2015 06:39
Ricon West 2013 : Full day streams jump list
## Day 1 - Track 1 ##
00:10:00 Pat Helland: Keystone - Between a ROC and a SOFT place
01:12:18 Lindsey Kuper: LVars: Lattice-based Data Structures for Deterministic Parallelism
02:11:54 Eric Redmond: Yokozuna!
04:10:50 Justin Shoffstall & Charlie Voiselle: The Seven-Layer Burrito; Troubleshooting a Distributed Database in Production
05:11:00 Peter Bailis: Bad as I wanna be - Coordination and Consistency in Distributed Databases
06:13:24 Joseph Blomstedt: Bringing Consistency to Riak (Part 2)
07:16:22 Lightning talks (_nb_: you **must** see @tsantero!)
bind-key -temacs-copy c copy-selection
bind-key -temacs-copy x copy-pipe "reattach-to-user-namespace /usr/bin/pbcopy"
bind-key -temacs-copy z copy-pipe "mate"
@etrepum
etrepum / gist:5664126
Last active December 17, 2015 19:59
gproc notes

TL;DR: gproc probably isn't what you need, but OTP's global module will probably work fine.

gproc [1][1] has a module gproc_dist that uses gen_leader [2][2] for coordination, no mnesia is involved. Some of the details for how it was originally designed are in Ulf's paper on it [3][3].

The significant disadvantages are:

  • The node list by default must be static and known at start time! This will make expanding the cluster a non-starter without changes to gproc and/or gen_leader. There appears to be some experimental/undocumented way to expand a cluster that might work [4][4]
  • There might be incorrect logic for net-splits (either detection or resolution) [5][5]

There doesn't appear to be a better global process registry available. The only other one I was able to find easily was ngproc [6][6] which suffers from the same sort of limitations and doesn't seem to be actively maintained.

Rollback a transaction when user exits a route

I just stubmled upon an issue in my app where a user can go to edit his profile, but instead of saving the form he just leaves to another page where he can post a status (User has many Statuses).

But to make sure that he's just posting a status and not committing something else I want to put that status into a separate transaction

createStatus: function() {
  var transaction = this.get("store").transaction(),
      text = this.get("text"),
@vinoski
vinoski / fd_setsize_on_osx.md
Last active November 7, 2017 06:20
How to raise the maximum number of file descriptors when building Erlang/OTP on OS X.

When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.

First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:

perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in 

Next, when you run configure in your Erlang/OTP source directory, be sure to include the right CFLAGS setting, as shown below:

CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
@sureshsaggar
sureshsaggar / Apache FlumeNG and HDFS Sink
Created October 31, 2012 16:16
Apache FlumeNG and HDFS Sink
# Directory:
# root@localhost:~/flume/apache-flume-1.4.0-SNAPSHOT
# Usage:
# bin/flume-ng agent --conf ./conf/ -f conf/flume-agents-tests.conf -Dflume.root.logger=DEBUG,console -n agent_test_exec_TO_hdfs
# ------------------------------------------------------------------------------------
# This workflow applies to some WebServer running flume agent and dumping data
# back in HDFS. Here /tmp/ping.txt could be any log file.
# ------------------------------------------------------------------------------------
@mistersourcerer
mistersourcerer / color.sh
Created October 10, 2012 15:06
Colorizing Ruby [or other lang] code from command line, to paste in keynote
#!/bin/bash
#http://pygments.org/docs/cmdline/
LANG="ruby"
if [ -n "$2" ]
then
LANG=$2;
fi
@lynaghk
lynaghk / 0-update.md
Last active July 5, 2022 13:33
Angular.js from ClojureScript
(defproject vix "1.0.0-SNAPSHOT"
:description "Vix is a document repository and management system."
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/data.codec "0.1.0"]
[org.clojure/data.json "0.1.2"]
[org.clojure/algo.generic "0.1.0"]
[slingshot "0.10.3"]
[org.mindrot/jbcrypt "0.3m"]
[compojure "1.1.0"]
[ring/ring-core "1.1.1"]

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone