Skip to content

Instantly share code, notes, and snippets.

View jackbit's full-sized avatar

Yacobus Reinhart jackbit

View GitHub Profile
@jackbit
jackbit / em-stream-tail.rb
Created February 29, 2012 01:48 — forked from zpoley/em-stream-tail.rb
Simple stream tail -f over http socket using Ruby EventMachine
#!/usr/bin/env ruby
#
# README: Start server with em-stream-tail.rb tail-filename
# Connect to server with curl http://localhost:8083
# Observe log events on curl.
#
require 'rubygems'
require 'eventmachine'
if ARGV.empty?
@jackbit
jackbit / mongoid-cheatsheet.md
Created April 15, 2012 15:06 — forked from icebreaker/mongoid-cheatsheet.md
Mongoid cheat sheet
@jackbit
jackbit / gist:3347643
Created August 14, 2012 08:55 — forked from mperham/gist:1379464
Flexibility without Dependency Injection
class TaxCode
GENERATORS = {
:us => lambda { |id| "US-#{id}" },
:br => lambda { |id| "#{id + 9}-BRA" },
}
def self.generate(code, id)
gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}"
gen.call(id)
end
# Application Generator Template
# Modifies a Rails app to use Devise with RSpec and Cucumber
# Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-devise-rspec-cucumber-template.rb -T
# Information and a tutorial:
# https://github.com/RailsApps/rails3-devise-rspec-cucumber
# Generated using the rails_apps_composer gem:
# https://github.com/RailsApps/rails_apps_composer/
# Authored by : Yacobus Reinhart
# Contact : Yacobus.Reinhart@gmail.com
# TODO : Convert it to Gem
require 'httparty'
require 'antigate'
module RobotParty
# Example usage:
# header_cookies_login = {'Cookie' => cookies}
# result = RobotParty.call("http://example.com/target_path", header_cookies_login)
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@jackbit
jackbit / install_rails.txt
Last active December 16, 2015 11:49
Cara Install Rails dari Awal
LINUX USER
--------------------
Langkah 1: Install dependency libraries
$ sudo apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
Langkah 2:
Tambahkan user baru jangan gunakan root untuk production:
useradd -m -d /home/new_user -s /bin/bash -g staff new_user
Kemudian Ikuti langkah diweb berikut untuk membuat ssh-key agar bisa terhubung dengan github
https://help.github.com/articles/generating-ssh-keys
@jackbit
jackbit / nginx.conf
Last active August 29, 2015 14:02
Standard Enterprise Nginx Conf
worker_processes 2;
worker_rlimit_nofile 65000;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
@jackbit
jackbit / app_name
Last active August 29, 2015 14:02
application config for nginx and pagespeed
upstream app_upstream {
server unix:/home/user/app_folder/current/tmp/sockets/app.sock fail_timeout=0;
}
server {
listen 80;
server_name domain-name.com www.domain-name.com;
root /home/user/app_folder/current/public;
try_files $uri /system/maintenance.html @app_upstream;
@jackbit
jackbit / nginx
Created June 14, 2014 10:00
init.d nginx
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon