most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
import bisect | |
import itertools | |
import operator | |
class _BNode(object): | |
__slots__ = ["tree", "contents", "children"] | |
def __init__(self, tree, contents=None, children=None): | |
self.tree = tree |
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
import json | |
from functools import wraps | |
from flask import redirect, request, current_app | |
def support_jsonp(f): | |
"""Wraps JSONified output for JSONP""" | |
@wraps(f) | |
def decorated_function(*args, **kwargs): | |
callback = request.args.get('callback', False) | |
if callback: |
<?php | |
require 'autoload.php'; | |
$redis = new Predis\Client('tcp://127.0.0.1', 'dev'); | |
// *** NOTE *** Lua's unpack() has a limit on the size of the table imposed by | |
// the number of Lua stack slots that a C function can use. This value is defined | |
// by LUAI_MAXCSTACK in luaconf.h and for Redis is set to 8000, which translates | |
// to an hash of 4000 elements since HGETALL returns a list that interleaves field |
Copyright (C) 2012 Justin Poliey <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT |
# fabric extension to enable handling expected prompts | |
# | |
# Read more at http://ilogue.com/jasper/blog/fexpect--dealing-with-prompts-in-fabric-with-pexpect/ | |
# | |
# This file Copyright (c) Jasper van den Bosch, ilogue, [email protected] | |
# Pexpect Copyright (c) 2012 Noah Spurrier ,see: http://www.noah.org/wiki/pexpect#License | |
from fabric.state import env | |
import fabric.api |
require("riak-php-client/riak.php"); | |
$client = new RiakClient('127.0.0.1', 8098); | |
$mr = new RiakMapReduce($client); | |
$keys = array("TFrWAVz8RRVEEqCH3nS27O4InLB","FEwZgNI4VTJSIZxSas0QpOCCXjn","EkSkmblyIAT5VL7xYpScP2GP71G"); | |
foreach ($keys as $key) { | |
$mr->add("local_ns~users", $key); | |
} | |
$mr->map("Riak.mapValues"); |
DROP FUNCTION IF EXISTS SPLIT; | |
DROP FUNCTION IF EXISTS _SPLIT; | |
DROP FUNCTION IF EXISTS RTSPLIT; | |
DROP FUNCTION IF EXISTS LTSPLIT; | |
DELIMITER // | |
-- Simple Split (no trim) | |
CREATE FUNCTION SPLIT(S CHAR(255), DELIM VARCHAR(30), S_INDEX TINYINT UNSIGNED) RETURNS VARCHAR(255) | |
BEGIN | |
RETURN _SPLIT(S, DELIM, S_INDEX, '', 0); |