Skip to content

Instantly share code, notes, and snippets.

View aserafin's full-sized avatar

Adrian Serafin aserafin

View GitHub Profile
@aserafin
aserafin / net_http.rb
Created September 13, 2021 14:59
Enable debug for net/http
require 'net/http'
module Net
class HTTP
def self.enable_debug!
raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development'
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
pg_createcluster 9.5 main
pg_ctlcluster 9.5 main start
pg_lsclusters
@aserafin
aserafin / install.sh
Last active August 19, 2021 19:17
How to install Postgresql 9.4 + Postgis with SFCGAL support on Ubuntu 14.04
#!/bin/bash
# add postgresql official repository to apt
apt-get update
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# install required libraries
apt-get install -y autoconf build-essential cmake docbook-mathml docbook-xsl libboost-dev libboost-thread-dev libboost-filesystem-dev libboost-system-dev libboost-iostreams-dev libboost-program-options-dev libboost-timer-dev libcunit1-dev libgdal-dev libgeos++-dev libgeotiff-dev libgmp-dev libjson0-dev libjson-c-dev liblas-dev libmpfr-dev libopenscenegraph-dev libpq-dev libproj-dev libxml2-dev postgresql-server-dev-9.4 xsltproc git build-essential wget
@aserafin
aserafin / resque.rake
Created October 10, 2013 10:10
clear all resque tasks from redis
desc "Clear pending tasks"
task "resque:clear" => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
puts "Clearing delayed..." # in case of scheduler - doesn't break if no scheduler module is installed
Resque.redis.keys("delayed:*").each do |key|