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
@randysecrist
randysecrist / gist:1994620
Created March 7, 2012 17:41
osx-gcc-installer, erlang r14b04, os x 10.7.3
cc -o prlink.o -c -m32 -Wall -fno-common -pthread -O2 -fPIC -UDEBUG -DNDEBUG=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DXP_MACOSX=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_ -I../../../dist/include/nspr -I../../../pr/include -I../../../pr/include/private -I/Developer/Headers/FlatCarbon prlink.c
prlink.c:48:27: error: CodeFragments.h: No such file or directory
prlink.c:49:23: error: TextUtils.h: No such file or directory
prlink.c:50:19: error: Types.h: No such file or directory
prlink.c:51:21: error: Aliases.h: No such file or directory
prlink.c:52:19: error: CFURL.h: No such file or directory
prlink.c:53:22: error: CFBundle.h: No such file or directory
prlink.c:54:22: error: CFString.h: No such file or directory
prlink.c:55:26: error: CFDictionary.h: No such file or directory
prlink.c:56:20: error: CFData.h: No such file or directory
(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"]
@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.
# ------------------------------------------------------------------------------------

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"),
@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.

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"
@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!)

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

@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>
@tenderlove
tenderlove / person_test.rb
Created February 10, 2011 23:04
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
module Tenderlove
class Spec < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')