Skip to content

Instantly share code, notes, and snippets.

View kuntoaji's full-sized avatar
🎯
Focusing

KAK kuntoaji

🎯
Focusing
View GitHub Profile
@kuntoaji
kuntoaji / nginx.conf
Last active August 29, 2015 13:55
Nginx Load Balancer Configuration
# default nginx configuration
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
<!DOCTYPE html>
<html>
<head>
<title>CSS jQuery Modal Overlay</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="main.js" type="text/javascript"></script>
<link href="main.css" media="all" rel="stylesheet" type="text/css">
</head>
<body>
<div id="overlay"></div>
@kuntoaji
kuntoaji / nginx.conf
Last active August 29, 2015 13:55
Konfigurasi Nginx Static Assets Files
# Nginx default configuration
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
#!/usr/bin/env ruby
require 'open-uri'
user_agent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36"
saved_url_list = "saved_list.txt"
accessed_urls = []
accessed_urls = File.readlines(saved_url_list) if File.exists?(saved_url_list)
# tps terbanyak 149

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/trunk/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@kuntoaji
kuntoaji / deploy.rb
Created August 8, 2015 17:57
Discourse Configuration
# config/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'
set :term_mode, nil
set :rails_env, 'production'
class UserSessionsController < ApplicationController
before_filter :require_logout, :only => [:new, :create, :auth_fb_connect]
before_filter :set_facebook_session, :only => [:new, :create, :destroy, :auth_fb_connect]
helper_method :facebook_session, :only => [:new, :create, :destroy, :auth_fb_connect]
def new
@user_session = UserSession.new
end
def create
puts hellow world with gist client
class UserSession < Authlogic::Session::Base
end
puts 'hellow world with gist client'