Skip to content

Instantly share code, notes, and snippets.


ayucat ayucat

View GitHub Profile
ayucat /
Created Dec 9, 2014
Find duplicated files in the directory (and sub directories)
for name in $(find . -type f | xargs -I {} basename {} | sort | uniq -d); do find . -type f -name "$name"; done
ayucat /
Created Oct 6, 2014
elk 1.4.0-beta / 1.4.2 / 3: for debian/ubuntu
# E
wget -qO - | sudo apt-key add -
echo 'deb stable main' | sudo tee /etc/apt/sources.list.d/elasticsearch.list
sudo update-rc.d elasticsearch defaults 95 10
sudo /etc/init.d/elasticsearch start
# L
echo 'deb stable main' | sudo tee /etc/apt/sources.list.d/logstash.list
for id in $(aws ec2 describe-instances | jq -c '.Reservations[].Instances[] | select(.State.Name == "running") | .BlockDeviceMappings[].Ebs.VolumeId' | sed 's/"//g'); do aws ec2 describe-volumes | jq -c ".Volumes[] | select(.VolumeId == \"$id\") | .Size"; | done awk '{s+=$1} END {print s}'
View GrowthForecast.diff
diff --git a/ b/
index 9a32a1d..7babee9 100755
--- a/
+++ b/
@@ -9,7 +9,7 @@ use File::Basename;
use Getopt::Long;
use Plack::Loader;
use Plack::Builder;
-use Plack::Builder::Conditionals;
+use Plack::Middleware::Conditional;
ayucat /
Created Mar 5, 2013
f**kin latest version checker for packages managed with pear
pear list-upgrades |grep -v 'No upgrades available'
ayucat / Gemfile
Created Feb 25, 2013
How to install Rails 4.0-beta from scratch (on a non-dev machine) cf.
View Gemfile
source ''
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails'
group :assets do
gem 'uglifier', '>= 1.0.3'
gem 'journey', github: 'rails/journey'
gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
ayucat /
Last active Oct 12, 2015
to initialze tmp directories for CakePHP 2.x as well as 1.x
for f in app/tmp/{logs,cache/{,persistent,models}}; do mkdir -p $f; chmod -R 777 $f; touch $f/empty; done
ayucat / table2wikitable.rb
Created Dec 5, 2011
a simple converter of table markuped as html to wikitable on mediawiki
View table2wikitable.rb
#!/usr/bin/env ruby
# encoding: utf-8
require 'nokogiri'
@doc = Nokogiri::HTML::DocumentFragment.parse <<-EOHTML
@tables = @doc.xpath("table")
ayucat /
Created Jan 18, 2011
preparation of environment on Ubuntu 11.04
# Ref.
sudo apt-get build-dep thunderbird
sudo apt-get install mercurial yasm libcurl4-openssl-dev