Skip to content

Instantly share code, notes, and snippets.

@STAR-ZERO
STAR-ZERO / memo.md
Last active December 14, 2016 08:55
nginx + unicorn + capistrano設定

nginx + unicorn + capistrano設定メモ

Nginx

起動

$ nginx

停止

package main
import (
"fmt"
"log"
"flag"
"time"
@davidvthecoder
davidvthecoder / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
@zakuroishikuro
zakuroishikuro / mechanize_with_local_html.rb
Created April 10, 2014 05:42
Mechanizeでローカルファイルを扱う (ディレクトリ内のhtmlの場合)
require 'mechanize'
name = "foo.html"
path = File.expand_path(name, __FILE__)
agent = Mechanize.new
page = agent.get("file://#{path}")
とりあえずupdate
# sudo yum update -y
必要なもんを用意
# wget https://mecab.googlecode.com/files/mecab-0.996.tar.gz
# wget https://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz
解凍
# tar xvfz mecab-0.996.tar.gz
# tar xvfz mecab-ipadic-2.7.0-20070801.tar.gz
@keitaj
keitaj / ar_innodb_row_format.rb
Created March 7, 2015 01:21
utf8mb4で動かすために必要。create_tableメソッドで'ROW_FORMAT=DYNAMIC'がデフォルトで指定されるようにしておく。http://qiita.com/kamipo/items/101aaf8159cf1470d823
ActiveSupport.on_load :active_record do
module ActiveRecord::ConnectionAdapters
class AbstractMysqlAdapter
def create_table_with_innodb_row_format(table_name, options = {})
table_options = options.merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
create_table_without_innodb_row_format(table_name, table_options) do |td|
yield td if block_given?
end
end
alias_method_chain :create_table, :innodb_row_format
@Drunkar
Drunkar / Dockerfile
Created May 21, 2015 12:21
elasticsearch 1.5.2 with plugins: mobz/elasticsearch-head, polyfractal/elasticsearch-inquisitor, elasticsearch/elasticsearch-analysis-kuromoji/2.5.0 dockerhub: https://registry.hub.docker.com/u/drunkar/elasticsearch/
FROM java:7-jre
# grab gosu for easy step-down from root
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu
@blinksmith
blinksmith / X509KeyPairtest.go
Created February 26, 2016 20:50
Golang crypto/tls.X509KeyPair function usage example
package main
import (
"fmt"
"os"
"crypto/tls"
"crypto/x509"
)
func main() {
var rsaCertPEM = [] byte(`-----BEGIN CERTIFICATE-----
MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS
// https://webreflection.medium.com/using-the-input-datetime-local-9503e7efdce
Date.prototype.toDatetimeLocal =
function toDatetimeLocal() {
var
date = this,
ten = function (i) {
return (i < 10 ? '0' : '') + i;
},
YYYY = date.getFullYear(),
MM = ten(date.getMonth() + 1),
@shunirr
shunirr / criminal_jc.md
Last active December 25, 2024 04:13
女子中学生チケット詐欺事件

criminal_jc