Skip to content

Instantly share code, notes, and snippets.

@aaronlifton3
aaronlifton3 / flask_geventwebsocket_example.py
Created September 30, 2012 05:26 — forked from lrvick/flask_geventwebsocket_example.py
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
// Implementing the publishing Pusher REST API
// @see http://pusher.com/docs/rest_api
// with Play (scala) Framework
// @see http://scala.playframework.org/
class Pusher {
val appId = Play.configuration.getProperty("pusher.appId")
val key = Play.configuration.getProperty("pusher.key")
val secret = Play.configuration.getProperty("pusher.secret")
@aaronlifton3
aaronlifton3 / app.rb
Created July 26, 2013 20:08 — forked from cpatni/app.rb
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
package com.snowdale.play.extensions
import com.twitter.util.{ Future, Return, Throw , Duration}
import play.api.libs.concurrent._
import java.util.concurrent.TimeUnit
object Finagle {
implicit def futureTransform[A](future: Future[A]) = new FinagleFuture(future)
}
// Rewrite http://tour.golang.org/#63 to scala using Channel
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
object GO63Channel extends App {
def sum(a: List[Int], c: Channel[Int]) = future {
c write a.sum
}
val c = new Channel[Int]()

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@aaronlifton3
aaronlifton3 / es.sh
Last active December 23, 2015 09:49 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@aaronlifton3
aaronlifton3 / redis_install_centos.txt
Last active December 23, 2015 11:28 — forked from coder4web/redis_install_centos.txt
updated redis centos install script
But today we want to compile redis from source (see http://redis.io/download)
yum install make gcc tcl
cd /usr/local/src
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar xzf redis-2.6.16.tar.gz
cd redis-2.6.16
make
make test
make install