Skip to content

Instantly share code, notes, and snippets.

View avsej's full-sized avatar
🛋️
On the couch

Sergey Avseyev avsej

🛋️
On the couch
View GitHub Profile
@ingenthr
ingenthr / StoreHandler.java
Created March 29, 2012 03:19
Sample of exponential backoff on a set with Couchbase Server
package com.couchbase.sample.dataloader;
import com.couchbase.client.CouchbaseClient;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.ops.OperationStatus;
/**
@avsej
avsej / repositories.rake
Created February 27, 2012 15:04
DEB/RPM repository maintenance script
# GistID: 1924422
# Author:: Couchbase <info@couchbase.com>
# Copyright:: 2011, 2012 Couchbase, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@avsej
avsej / .Xresources
Created September 30, 2011 05:53
Configure urxvt colors and key mappings
!URxvt*scrollstyle: plain
URxvt.scrollBar: False
URxvt.font: xft:DejaVu Sans Mono:pixelsize=11:antialias=true
URxvt.boldFont: xft:DejaVu Sans Mono:Bold:pixelsize=11:antialias=true
URxvt*foreground: #000000
!URxvt*background: #d3d7cf
URxvt*background: #dedede
! black
@devongovett
devongovett / gist:1039559
Created June 22, 2011 05:27
JSONDB implementation
###
# JSONDB - a compressed JSON format
# By Devon Govett
# Originally proposed by Peter Michaux - http://michaux.ca/articles/json-db-a-compressed-json-format
#
# jsondb.pack converts an array of objects with the same keys (i.e. from a database)
# and flattens them into a single array, which is much smaller than the pure json
# representation where the keys are repeated for each item in the array.
# Combine with JSON.stringify to send compressed JSON data over the network.
#
@erlyvideo
erlyvideo / gist:881251
Created March 22, 2011 14:07
lib/sc_middleware.rb
# config/environment/development.rb:
# require 'lib/sc_middleware'
# config.middleware.use ScMiddleware
class ScMiddleware
def initialize(app)
@app = app
SC::Rack::Service.filesystem = true
@project = SC::Project.load(File.dirname(__FILE__)+"/../public/self_video", :parent => SC.builtin_project)
@sproutcore = SC::Rack::Service.new([@project])
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
diff --git a/postgresql/9.0/main/pg_hba.conf b/postgresql/9.0/main/pg_hba.conf
index 18831d3..f0d0e1d 100644
--- a/postgresql/9.0/main/pg_hba.conf
+++ b/postgresql/9.0/main/pg_hba.conf
@@ -80,13 +80,13 @@
# (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by UNIX sockets
-local all postgres ident
+# local all postgres trust
@doitian
doitian / wlist.rb
Created August 26, 2010 14:03
List windows for gpicker.
#!/usr/bin/env ruby
workspaces = {}
`wmctrl -d`.each_line do |line|
columns = line.split
if columns[7] == "N/A"
workspace_name = columns[8..-1].join(" ")
else
workspace_name = columns[9..-1].join(" ")
end