Skip to content

Instantly share code, notes, and snippets.

View thash's full-sized avatar
🌵
⭐️ ⭐️ ⭐️ ⭐️ ⭐️

Takuya Hashimoto thash

🌵
⭐️ ⭐️ ⭐️ ⭐️ ⭐️
View GitHub Profile
(let ((default-directory (expand-file-name "~/Dropbox/home/.emacs.d")))
(add-to-list 'load-path default-directory)
(load (expand-file-name "~/Dropbox/home/.emacs.d/subdirs.el") t t t))
(if (file-exists-p (locate-library "init"))
(load (locate-library "init") nil t nil))
@vvalgis
vvalgis / Capistrano tasks for starting unicorn.rb
Created May 7, 2010 08:13
Capistrano tasks for starting unicorn
set :rails_env, :production
set :unicorn_binary, "/usr/bin/unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@sugyan
sugyan / fizzbuzz.pl
Last active September 21, 2023 08:49
"^ "
=~ (
("(").("~"^"."^"^"^(""=="")."").("^"
^"="^(""=="").""^")").("^"^".").("="
^"~"^(""=="")."").("("^(""=="^").""^
"."^"^").("("^(""=="").""^"^"^")").(
(" ^( "
== "
") .
"" ^
@glebm
glebm / bootstrap_user.rb
Created April 18, 2011 21:21
Capistrano recipe to create a user on EC2
set :aws_private_key_path, "~/.ec2/mrkey.pem"
namespace :setup_server do
desc "adds a user and uploads his id_rsa.pub to the EC2 instance's deploy users authorized_keys2 file"
task :create_deploy_user do
# \\n becomes \n
commands = <<-SH.split("\n").map(&:strip).join(";")
sudo echo hi
sudo groupadd admin
@johnthethird
johnthethird / cap_notify.rb
Created May 4, 2011 20:02 — forked from rtekie/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
@shapeshed
shapeshed / nginx_rails_3_1
Created October 10, 2011 19:13
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@mathfur
mathfur / pre-commit
Created November 30, 2011 00:41
.git/hooks/pre-commit以下に配置すると、カレントディレクトリ以下にTODOが有る場合にコミットを禁止する。
#!/usr/bin/ruby
#
# .git/hooks/pre-commit以下に配置すると、カレントディレクトリ以下にTODOが
# 有る場合にコミットを禁止する。
# FORCE_COMMITフラグが立っていればTODO有りでもコミットできる
exit 0 if ENV["FORCE_COMMIT"] == "true"
todo_files = Dir["#{Dir.pwd}/**/*"].select do |path|
File.read(path).all?{|line| (line =~ /TODO/) and (line !~ /#.*TODO/)}
@riywo
riywo / dstat_log.pl
Created March 18, 2012 06:31
dstatのCSVをその場でパースしてなんかする方法
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX qw/mkfifo/;
use File::Temp qw/tempfile/;
use Scalar::Util qw/looks_like_number/;
use IO::Handle;
my $log_file = '/tmp/dstat.log';
my (undef, $pipe) = tempfile("dstat_XXXX", DIR => '/tmp', SUFFIX => '.pipe');