Skip to content

Instantly share code, notes, and snippets.

@shun115
shun115 / gist:6ed0f4d9ccfee00f806167c30224056f
Last active December 4, 2017 11:07
nginx + nginx-upload-module + jQuery-File-Upload + railsでchunk upload
# 参考: http://bclennox.com/extremely-large-file-uploads-with-nginx-passenger-rails-and-jquery
cd lib
git clone https://github.com/vkholodkov/nginx-upload-module.git
cd nginx-upload-module
# 新し目のnginxに対応したブランチに変更
git checkout 2.255
# nginx-upload-moduleでstateファイルにアクセスできないバグに対応するパッチを当てる
# https://github.com/vkholodkov/nginx-upload-module/issues/41#issuecomment-59182124
@shun115
shun115 / rails5.sh
Last active November 27, 2019 08:52
new rails5 project
$ cd path/to/project
$ Dockerfile-local-dev
FROM ruby:2.6.1
RUN apt update -qq \
&& apt install -y build-essential \
curl
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
@shun115
shun115 / gist:b028d62ecb9cd7861b5b
Last active June 24, 2016 03:31
new rails project
$ cd path/to/project
$ rbenv local 2.3.0
$ bundle init
$ vi Gemfile
$ cat Gemfile
source "https://rubygems.org"
gem "rails"
$ bundle install --path vendor/bundle
$ be rails new . -T -d mysql --skip-turbolinks
#!/bin/bash -ex
exec > >(tee /var/log/ffmpeg.log|logger -t user-data -s 2>/dev/console) 2>&1
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg
yum install --enablerepo=epel gcc gcc-c++ automake autoconf libtool yasm nasm -y
mkdir /root/lib
cd /root/lib
@shun115
shun115 / kick.rb
Last active August 29, 2015 13:57
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'cgi'
require 'time'
require 'openssl'
require 'base64'
require 'net/http'
require 'net/https'
require 'pp'
@shun115
shun115 / gist:5418736
Last active December 16, 2015 10:18
openframeworks でできたプログラムを、X Window System無し(Headless)に Ubuntu 12.10 にて動作させるための環境づくり。 Headless X として xvfb with GLX extension (Mesa 9.0.3) 使用。 サーバはEC2 使用。
### install Mesa
$ cd
$ mkdir lib
$ cd lib/
$ wget ftp://ftp.freedesktop.org/pub/mesa/9.0.3/MesaLib-9.0.3.tar.gz
$ tar xvzf MesaLib-9.0.3.tar.gz
$ cd Mesa-9.0.3/
$ sudo apt-get update
$ sudo apt-get install gcc g++ make autoconf wdiff libtool bison flex libxml2 python-libxml2 xutils-dev pkg-config libx11-dev libxext-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-xfixes0-dev libdrm-dev llvm-dev
$ ./configure --enable-xlib-glx --disable-dri
@shun115
shun115 / gist:2717001
Created May 17, 2012 06:32
CentOS minimalでのOracle Virtualbox VMセットアップ(Chef)
## CentOS-6.2-x86_64-minimal.iso完了後
# shutdown -h now
## ネットワーク設定はeth0をNATに、eth1をホストオンリーアダプタにする
# cd /etc/sysconfig/network-scripts/
# vi ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=dhcp
HWADDR="00:00:00:00:00:00"
NM_CONTROLLED="yes"
ONBOOT="yes"
@shun115
shun115 / gist:2026632
Created March 13, 2012 03:54
Ubuntuではじめにインストールするパッケージ群
$ sudo apt-get install zsh zsh-dev
$ sudo apt-get install curl
$ sudo apt-get install make
$ sudo apt-get install gcc
$ sudo apt-get install g++
$ sudo apt-get install emacs
$ sudo apt-get install emacs-goodies-el
$ sudo apt-get install git
$ sudo apt-get install subversion
$ sudo apt-get install zlib1g
@shun115
shun115 / webtail.py
Created February 15, 2012 09:49 — forked from maximebf/webtail.py
Web tail / tail -f as a webpage using websocket
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
@shun115
shun115 / gist:964069
Created May 10, 2011 08:01
emacs 23 用の.emacs
;; .emacs
;; enable visual feedback on selections
(setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs