This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prosgres Migration tool for crystal frameworks | |
# just create a ./db folder and add some migrations files | |
# ./db/0.sql | |
# ./db/1.sql | |
# ... | |
# ./db/22.sql # and so on ... | |
# | |
# Usage : | |
# require "pg" # I use a modified version solisoft/crystal-pg for now until main repo deployed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d dash script for Ubuntu or other *nix. | |
# Description: nginx init.d dash script for Ubuntu or other *nix. | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#user nobody; | |
worker_processes 8; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gwan.h" // G-WAN API | |
#pragma link "hiredis" | |
#include "hiredis/hiredis.h" | |
typedef struct | |
{ | |
redisContext *rCont; | |
redisReply *rReply; | |
} data_t; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
# Split an array with defined size | |
# [1,2,3,4,5,6,7].split_by_size(2) #=> [[1, 2], [3,4], [5,6], [7]] | |
def split_by_size(size = 500) | |
tmp = [] | |
newarray = [] | |
self.each_with_index do |a, i| | |
if i % size == 0 | |
unless tmp.blank? | |
newarray.push tmp + [a] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
environment = "www" | |
mongrel_rails = "/usr/local/bin/mongrel_rails" | |
result = `cd #{environment}/current && #{mongrel_rails} cluster::status`.split("\n") | |
result = result.map{|r| r unless r == ""}.compact | |
check = result.map{|r| r =~ /^found/}.compact | |
pids = [] | |
ports= [] | |
result.each do |r| | |
pid = r.scan /pid (\d+)$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Erlang R12B and Couchdb | |
sudo apt-get install automake autoconf libtool subversion-tools help2man | |
sudo apt-get install build-essential erlang libicu38 libicu-dev libcurl4-gnutls-dev | |
sudo apt-get install libreadline5-dev checkinstall libmozjs-dev wget | |
sudo apt-get build-dep erlang | |
sudo apt-get install java-gcj-compat java-gcj-compat-dev | |
wget http://www.erlang.org/download/otp_src_R12B-4.tar.gz | |
tar -xf otp_src_R12B-4.tar.gz | |
cd otp_src_R12B-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user admin; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on Ubuntu 12.04 from OVH VPS | |
sudo aptitude update | |
aptitude install build-essential git git-core curl zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties ruby redis-server memcached ruby-dev ufw htop fail2ban imagemagick libmagickwand-dev nodejs npm -y ruby libmysqlclient-dev | |
sudo echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
sudo gem install passenger -v 4.0.59 | |
sudo passenger-install-nginx-module --auto --auto-download --languages 'ruby' | |
sudo gem install rails -v 2.3.15 | |
sudo gem install atom -v 0.3 |
OlderNewer