Skip to content

Instantly share code, notes, and snippets.

View sauloperez's full-sized avatar
🏔️

Pau Pérez Fabregat sauloperez

🏔️
View GitHub Profile
@bkimble
bkimble / gist:1365005
Last active May 2, 2024 01:27
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@cdarne
cdarne / apache_setup.sh
Created May 24, 2012 11:17
Upstart/init.d config example for rails/passenger
sudo a2enmod proxy_http
sudo service apache2 restart
@jaymcgavren
jaymcgavren / heroku.md
Created May 25, 2012 05:47
A Code TV screencast on getting started with Heroku

Description

Heroku is a simple way to publish your Rails app, and a powerful platform that will allow it to scale. In this episode, Jay McGavren gets you started with your first Heroku app.

Set up your Rails app

Isolate your gem environment

  • You WANT Rails to fail locally if a gem isn't in your Gemfile
@semperos
semperos / simple-upstart.conf
Created June 18, 2012 15:05
Simple Ubuntu Upstart config
# goes inside /etc/init/foo.conf
# Upstart: /etc/init/service_name.conf
description "start passenger stand-alone"
author "Me <me@myself.am>"
# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn
@srpouyet
srpouyet / nginx.conf
Last active August 5, 2018 22:37
Nginx Upstart script (Ubuntu 12.04)
### Nginx upstart script
### source: http://serverfault.com/a/391737/70451
### /etc/init/nginx.conf
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/local/sbin/nginx
@spara
spara / createdb.sql
Created July 26, 2012 21:22
create database
# connect to postgres
psql -h localhost
# create database
CREATE DATABASE mydatabase;
# switch to your database
\connect mydatabase
# add postgis extension
@grosser
grosser / rake_autocomplete.rb
Created August 19, 2012 15:50 — forked from cayblood/rake_autocomplete.rb
Bash autocomplete script for rakefiles
#!/usr/bin/env ruby
# Complete rake tasks script for bash
# Save it somewhere and then add
# complete -C path/to/script -o default rake
# to your ~/.bashrc
# Xavier Shay (http://rhnh.net), combining work from
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb
# Nicholas Seckar <nseckar@gmail.com> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces
# Saimon Moore <saimon@webtypes.com>
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 1, 2024 13:31
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'