Skip to content

Instantly share code, notes, and snippets.

View linyows's full-sized avatar

Tomohisa Oda linyows

View GitHub Profile
@linyows
linyows / deploy.rb
Created November 1, 2011 05:32 — forked from alkema/deploy.rb
Capistrano task for a Node.js app with github Forever and NPM.
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, "git@github.com:user/app.git"
default_run_options[:pty] = true
set :user, "www-data"
set :domain, "foo.tld"
set :normalize_asset_timestamps, false
@linyows
linyows / deploy.rb
Created November 1, 2011 05:32 — forked from dakatsuka/deploy.rb
Capistrano recipe for Node.js + upstart
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
set :application, "nodeapp"
set :scm, :git
set :repository, "git://github.com:hogehoge/foobar.git"
set :branch, "master"
var formidable = require('formidable');
var http = require('http');
var sys = require('sys');
http.createServer(function(req, res) {
if (req.url == '/upload' && req.method.toLowerCase() == 'post') {
var form = new formidable.IncomingForm();
form.parse(req, function(error, fields, files) {
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received upload:\n\n');
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Socket.io File Upload Example</title>
<link rel=stylesheet href="/css/upload.css" media=all>
<script src="/socket.io/socket.io.js"></script>
@linyows
linyows / nginx.conf
Created January 10, 2012 05:24 — forked from sax/nginx.conf
unicorn + nginx on launchd
user sax staff;
worker_processes 1;
daemon off;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
pid /var/run/nginx.pid;
#!/bin/zsh
case "$1" in
test)
TYPE=$1
;;
clean)
TYPE=$1
;;
*)
@linyows
linyows / taifu
Created February 25, 2012 05:44 — forked from katsuma/taifu
taifu will add youtube sound to your iTunes library silently
#!/usr/bin/env ruby
# usage:
# taifu http://www.youtube.com/watch?v=KPWfBfFFrwsx
# taifu depends on VLC.app and rb-appscript gem
require 'rubygems'
require 'appscript'
require 'fileutils'
@linyows
linyows / git_tag
Created March 22, 2012 06:36
増えすぎたgitのtagを削除するスクリプト
#!/bin/zsh
case "$1" in
test)
TYPE=$1
;;
clean)
TYPE=$1
;;
*)
$ ruby -pe 'gsub(/^.+;| .+$/,"")' ~/.zsh-history | sort | uniq -c | sort -nr | head -30
echo "[Oh My Zsh] Would you like to check for updates?"
echo "Type Y to update oh-my-zsh: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]
then
_upgrade_zsh
fi