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
Properties systemProperties = System.getProperties();
systemProperties.put("net.spy.log.LoggerImpl", "net.spy.memcached.compat.log.SunLogger");
System.setProperties(systemProperties);
Logger logger = Logger.getLogger("com.couchbase.client");
logger.setLevel(Level.FINEST);
for(Handler h : logger.getParent().getHandlers()) {
if(h instanceof ConsoleHandler){
h.setLevel(Level.FINEST);
}
@avsej
avsej / vim-alternatives.sh
Created April 11, 2010 09:46
install alternatives for vim
#!/bin/sh
set -e
pkg=vim
mandir=/usr/share/man
bindir=/usr/local/bin
priority=30
update-alternatives --install /usr/bin/vim vim $bindir/vim $priority
update-alternatives --install /usr/bin/vimdiff vimdiff $bindir/vim $priority
class ActiveRecord::Base
before_validation :strip_whitespace_from_attributes!, :stringify_content_attributes!
private
# Will strip trailing and leading whitespace from all attributes and convert
# empty strings to nil.
def strip_whitespace_from_attributes!
for col in self.class.content_columns.collect{|c| c.name.to_sym}
if !self[col].nil? && self[col].respond_to?(:strip)
=begin
Author: Jabari Zakiya, Original: 2009-12-25
Revision-2: 2009-12-31
Revision-3: 2010-6-2
Revision-4: 2010-12-15
Revision-5: 2011-5-11
Revision-6: 2011-5-15
Module 'Roots' provides two methods 'root' and 'roots'
which will find all the nth roots of real and complex
@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
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
@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
@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 / gist:2345830
Created April 9, 2012 19:20
nginx config for thin
upstream thin_cluster {
server unix:/var/run/thin.0.sock;
server unix:/var/run/thin.1.sock;
server unix:/var/run/thin.2.sock;
}
server {
server_name squish.demo.couchbase.com;
root /home/couchbase/couchbase-squish/public;