Skip to content

Instantly share code, notes, and snippets.

Avatar

ayucat ayucat

View GitHub Profile
@ayucat
ayucat / find-dup.sh
Created Dec 9, 2014
Find duplicated files in the directory (and sub directories)
View find-dup.sh
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 Oct 6, 2014
elk 1.4.0-beta / 1.4.2 / 3: for debian/ubuntu
View 11-elk-setup.sh
#!/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
View aws_ebs_in_use.sh
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/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 Mar 5, 2013
f**kin latest version checker for packages managed with pear
View pear_checker.sh
#!/bin/sh
pear list-upgrades |grep -v 'No upgrades available'
@ayucat
ayucat / Gemfile
Created Feb 25, 2013
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/
View Gemfile
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 Oct 12, 2015
to initialze tmp directories for CakePHP 2.x as well as 1.x
View cakephp_tmp.sh
#!/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 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
<table></table>
EOHTML
@tables = @doc.xpath("table")
@ayucat
ayucat / thunderbird_build_natty.sh
Created Jan 18, 2011
preparation of environment on Ubuntu 11.04
View thunderbird_build_natty.sh
#!/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