This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
| #!/bin/sh | |
| msg=${1:-"first commit"} | |
| git init | |
| tree_hash=$(git write-tree) | |
| commit_hash=$(echo -n "$msg" | git commit-tree $tree_hash) | |
| echo $commit_hash > .git/refs/heads/master |
| # -*- coding: utf-8 -*- | |
| ARGV.each do |fn| | |
| lines = File.readlines(fn) | |
| hiki = lines.map { |l| | |
| l.sub(/^(#+)\s/){ '!'*($1.length) + ' ' }. | |
| sub(/^(-+)\s/){ '*'*($1.length) + ' ' }. | |
| gsub(/\!\[([^\]]+)\]\(([^\)]+)\)/){ $2[0..3] == 'http' ? $2 : ('http://goos-lokka.heroku.com' + $2) }. # picture | |
| gsub(/\[([^\]]+)\]\(([^\)]+)\)/, '[[\1|\2]]'). # url | |
| gsub(/\*\*([^*]*)\*\*/, "'''\\1'''"). | |
| sub(/^ /, ' '). |
| class S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def | |
| to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end | |
| def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740 | |
| puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! ##### |
| [ricky@t520 breakpoint]$ echo 'function foo() return "hi" end; print(foo())' | lua -i | |
| Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio | |
| > function foo() return "hi" end; print(foo()) | |
| hi | |
| > |
| thumbnail: http://pds.exblog.jp/pds/1/201101/16/02/d0055302_13383029.jpg | |
| video: http://www.youtube.com/watch?v=UE27t_LJpx0 |
| #!/usr/bin/env ruby | |
| r, w = IO.pipe | |
| pid = fork { | |
| w.close | |
| $stdin.reopen(r) | |
| r.close | |
| IO.select([$stdin], nil, [$stdin]) | |
| exec 'more' |
| require 'HTTP' | |
| require 'UV' | |
| module Sinachiku | |
| @routes = { 'GET' => [], 'POST' => [] } | |
| def self.route(method, path, opts, &block) | |
| @routes[method] << [path, opts, block] | |
| end | |
| def self.do(r) | |
| @routes[r.method].each {|path| |
| # Example MySQL config file for small systems. | |
| # | |
| # This is for a system with little memory (<= 64M) where MySQL is only used | |
| # from time to time and it's important that the mysqld daemon | |
| # doesn't use much resources. | |
| # | |
| # MySQL programs look for option files in a set of | |
| # locations which depend on the deployment platform. | |
| # You can copy this option file to one of those | |
| # locations. For information about these locations, see: |
| Copyright (C) 2012 Yoshimasa Niwa | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |