Skip to content

Instantly share code, notes, and snippets.

View ayucat's full-sized avatar

ayucat ayucat

View GitHub Profile
@ayucat
ayucat / find-dup.sh
Created December 9, 2014 08:42
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
ayucat / 11-elk-setup.sh
Created October 6, 2014 03:45
elk 1.4.0-beta / 1.4.2 / 3: for debian/ubuntu
#!/bin/sh
# E
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
echo 'deb http://packages.elasticsearch.org/elasticsearch/1.4/debian 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 http://packages.elasticsearch.org/logstash/1.4/debian stable main' | sudo tee /etc/apt/sources.list.d/logstash.list
@ayucat
ayucat / aws_ebs_in_use.sh
Last active August 29, 2015 14:04
AWS EBS size
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}'
@ayucat
ayucat / GrowthForecast.diff
Created September 16, 2013 08:12
a patch for kazeburo-growthforecast to https://github.com/kazeburo/GrowthForecast.git
diff --git a/growthforecast.pl b/growthforecast.pl
index 9a32a1d..7babee9 100755
--- a/growthforecast.pl
+++ b/growthforecast.pl
@@ -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
ayucat / pear_checker.sh
Created March 5, 2013 00:59
f**kin latest version checker for packages managed with pear
#!/bin/sh
pear list-upgrades |grep -v 'No upgrades available'
@ayucat
ayucat / Gemfile
Created February 25, 2013 06:29
How to install Rails 4.0-beta from scratch (on a non-dev machine) cf. http://www.zlu.me/blog/2012/10/29/install-and-create-rails-4-dot-0-app/
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails'
group :assets do
gem 'uglifier', '>= 1.0.3'
end
gem 'journey', github: 'rails/journey'
gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
@ayucat
ayucat / cakephp_tmp.sh
Last active October 12, 2015 15:48
to initialze tmp directories for CakePHP 2.x as well as 1.x
#!/bin/bash
for f in app/tmp/{logs,cache/{,persistent,models}}; do mkdir -p $f; chmod -R 777 $f; touch $f/empty; done
@ayucat
ayucat / table2wikitable.rb
Created December 5, 2011 18:03
a simple converter of table markuped as html to wikitable on mediawiki
#!/usr/bin/env ruby
# encoding: utf-8
require 'nokogiri'
@doc = Nokogiri::HTML::DocumentFragment.parse <<-EOHTML
<table></table>
EOHTML
@tables = @doc.xpath("table")
@ayucat
ayucat / thunderbird_build_natty.sh
Created January 18, 2011 02:31
preparation of environment on Ubuntu 11.04
#!/bin/sh
# Ref. https://developer.mozilla.org/en/Simple_Thunderbird_build
sudo apt-get build-dep thunderbird
sudo apt-get install mercurial yasm libcurl4-openssl-dev