Skip to content

Instantly share code, notes, and snippets.

View hakanensari's full-sized avatar

Hakan Ensari hakanensari

  • Amsterdam
  • 04:03 (UTC +02:00)
View GitHub Profile
@hakanensari
hakanensari / circle.yml
Created November 16, 2015 23:31 — forked from jonah-williams/circle.yml
Automating deployments to Heroku from CircleCI
test:
override:
- bundle exec rspec spec
deployment:
acceptance:
branch: master
commands:
- ./script/heroku_deploy.sh <ACCEPTANCE_HEROKU_APP>:
timeout: 300
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
/* How to calculate postgreSQL database size in disk ? */
SELECT pg_size_pretty(pg_database_size('thedbname'));
/* Calculate size of a table including or excluding the index */
SELECT pg_size_pretty(pg_total_relation_size('big_table'));
SELECT pg_size_pretty(pg_relation_size('big_table')); /* without index */
/* See indexes on a table with `\d tablename` */
#!/bin/sh
filename=$1
echo "Begin processing file:" $filename
dimensions=$(identify -format '%w %h' $filename)
IFS=' ' read -a array <<< "$dimensions"
width=${array[0]}
height=${array[1]}
@hakanensari
hakanensari / readme.md
Created June 19, 2012 16:33 — forked from mislav/readme.md
CLI tool that checks the build status of current branch on Travis CI

Check build status of a project on the command line

Install (copy & paste):

curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
  && chmod +x ~/bin/travis

gem install hub | tail -2
ruby -e 'require "json"' 2&gt;/dev/null || gem install json
@hakanensari
hakanensari / rbenv-install-system-wide.sh
Created October 31, 2011 19:45
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@hakanensari
hakanensari / _config.yml
Created October 20, 2011 22:34 — forked from edavis10/_config.yml
Pagination in Jekyll
# ....other stuff here
paginate: 10
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
ENV["PATH"] = "/opt/ruby/bin:#{ENV['PATH']}"
ENV["RAILS_ENV"] = "production"
ENV["QUEUE"] = "*"
Bluepill.application("nichelator") do |app|
app.working_dir = "/var/apps/nichelator/current"
app.uid = "app"
app.gid = "app"
2.times do |i|
app.process("resque-#{i}") do |process|