Skip to content

Instantly share code, notes, and snippets.

Constantine Nikolaou cnicolaou

Block or report user

Report or block cnicolaou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cnicolaou / gist:1438212
Created Dec 6, 2011
Convert string chars to hex values
View gist:1438212
ree-1.8.7-2011.03 :027 > array = []
=> []
ree-1.8.7-2011.03 :028 > "hello".each_byte {|x| array << x}
=> "hello"
ree-1.8.7-2011.03 :029 > array.join(",")
=> "104,101,108,108,111"
cnicolaou / super_simple_sqs.rb
Created Oct 26, 2011 — forked from ssimeonov/super_simple_sqs.rb
This is a simple way to post a message to Amazon SQS w/o any gems (the queue must already exist)
View super_simple_sqs.rb
module Amazon
module Authentication
@@digest ="sha256")
def sign(auth_string)
Base64.encode64(OpenSSL::HMAC.digest(digester, aws_secret_access_key, auth_string)).strip
def digester
cnicolaou / compress_requests.rb
Created Aug 5, 2011 — forked from subdigital/compress_requests.rb
Rack Middleware to automatically unzip gzipped/deflated POST data
View compress_requests.rb
class CompressedRequests
def initialize(app)
@app = app
def call(env)
if env['REQUEST_METHOD'] =~ /(POST|PUT)/
if env.keys.include? 'HTTP_CONTENT_ENCODING'
input = env['rack.input'].read
View nl.yml
# Dutch translation in YML by Ariejan de Vroom <>
# - Sponsored by Kabisa ICT -
# Fully compatible with Translate (the Rails translation plugin)
# -
separator: ","
cnicolaou / git reset --hard HEAD ; git pull --rebase origin 2.0.0pre
Created Jun 14, 2011
git reset --hard HEAD ; git pull --rebase origin 2.0.0pre
View git reset --hard HEAD ; git pull --rebase origin 2.0.0pre
(14:38) user:~/dev/rubinius(master)$ git reset --hard HEAD ; git pull --rebase origin 2.0.0pre
HEAD is now at 9175c06 Merge pull request #1014 from apotheon/master
remote: Counting objects: 8015, done.
remote: Compressing objects: 100% (3301/3301), done.
remote: Total 7234 (delta 4511), reused 6178 (delta 3695)
Receiving objects: 100% (7234/7234), 3.40 MiB | 51 KiB/s, done.
Resolving deltas: 100% (4511/4511), completed with 320 local objects.
From git://
* branch 2.0.0pre -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
cnicolaou / rvm + rubinius
Created Jun 14, 2011
installing rubinius using rvm
View rvm + rubinius
(12:17) user:~$ rvm install rbx-2.0.0pre
rbx-2.0.0pre installing #dependencies
Pulling from origin 2.0.0pre
ERROR: Error running 'git reset --hard HEAD ; git pull --rebase origin 2.0.0pre', please read /Users/user/.rvm/log/rbx-2.0.0pre/rbx.repo.log
fatal: Not a git repository (or any of the parent directories): .git
Copying from repo to source...
chmod: ./configure: No such file or directory
rbx-2.0.0pre - #configuring
ERROR: Error running '/Users/user/.rvm/wrappers/ree-1.8.7-2011.03/ruby ./configure --prefix=/Users/user/.rvm/rubies/rbx-2.0.0pre --skip-system ', please read /Users/user/.rvm/log/rbx-2.0.0pre/configure.log
ERROR: There has been an error while running '/Users/user/.rvm/wrappers/ree-1.8.7-2011.03/ruby ./configure --prefix=/Users/user/.rvm/rubies/rbx-2.0.0pre --skip-system '.
View Unicorn capistrano deploy.rb
# capistrano deployment
require "bundler/capistrano"
require "capistrano/ext/multistage"
set :stages, %w(canary production)
set :default_stage, "canary"
set :application, "lolcats"
set :deploy_to, "/srv/#{application}"
View trivial_file_upload_service.rb
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])
View rails binary gems
config.gem 'factory_girl',
:version => '>= 1.2.3' unless, 'vendor/plugins/factory_girl'))
# Cucumber and dependencies
config.gem 'polyglot', :lib => false,
:version => '0.2.9' unless, 'vendor/plugins/polyglot'))
config.gem 'treetop', :lib => false,
:version => '1.4.3' unless, 'vendor/plugins/treetop'))
config.gem 'term-ansicolor', :lib => false,
View gsl install failure
(09:34) cn5:~/Downloads/gsl-1.9$ gem install gsl
Building native extensions. This could take a while...
ERROR: Error installing gsl:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking gsl version... 1.9
checking gsl cflags... -I/usr/local/include
checking for main() in -lcblas... yes
checking for main() in -latlas... yes
You can’t perform that action at this time.