Skip to content

Instantly share code, notes, and snippets.

View hnagato's full-sized avatar

nagato hnagato

  • Japan
View GitHub Profile
@hnagato
hnagato / README.md
Last active December 19, 2015 19:39 — forked from juno/README.md

Install rbenv and ruby-build to Amazon Linux (cloud-init).

  1. Copy & paste content of user-data.sh to EC2 RunInstances user-data
  2. Then, logging in to EC2 instance as ec2-user and run install-ruby.sh.
@hnagato
hnagato / gist:3234497
Created August 2, 2012 06:28
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value={DBInstanceClassMemory/32}, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@hnagato
hnagato / sysctl.conf
Created July 8, 2012 10:14
/etc/sysctl.conf
net.inet.tcp.delayed_ack=0
net.inet.tcp.recvspace=1027840
net.inet.tcp.sendspace=134320
net.inet.udp.recvspace=88320
net.local.stream.sendspace=65536
net.local.stream.recvspace=65536
Number.format = function(n) {
return String(n).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};
#!/bin/bash
find . -type d -depth 1 ! -name gists |
parallel -k -j 1000% 'cd {}; echo \[{}\]; git st --short'
@hnagato
hnagato / brew-rbenv-2012-03-01.sh
Created March 1, 2012 09:14
Install ruby with homebrew, rbenv and ruby-build on OSX 10.7
# Install rbenv, ruby-build and readline
brew install rbenv ruby-build readline
brew link readline
# Add rbenv init to .zshenv
cat <<-EOF | ruby -pe 'gsub("\\", "")' >> .zshenv
# rbenv
if which rbenv >/dev/null 2>&1; then
eval "$\(rbenv init -\)"
source /usr/local/Cellar/rbenv/0.3.0/completions/rbenv.zsh
@hnagato
hnagato / output256_location.rb
Created February 21, 2012 06:31
location 表示 + screen_name をもうちょいカラフルに
# -*- coding: utf-8 -*-
module Earthquake
module Output
require 'uri'
def puts_items(items)
mark_color = [ config[:colors].sample, 1 ].flatten # random & bold
[items].flatten.reverse_each do |item|
<?xml version="1.0"?>
<root>
<list>
<item>
<name>LeaveInsMode with EISUU(Terminal)</name>
<identifier>private.app_terminal_esc_with_eisuu</identifier>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::JIS_EISUU</autogen>
<autogen>--KeyToKey-- KeyCode::BRACKET_LEFT, VK_CONTROL, KeyCode::BRACKET_LEFT, VK_CONTROL, KeyCode::JIS_EISUU</autogen>
</item>
#!/bin/bash
parallel -k -j+0 brew install {} ::: `brew outdated | cut -f 1` && brew cleanup
@hnagato
hnagato / hackernews.user.css
Created January 21, 2011 19:28
Hacker News の文字小さい…
@charset "utf-8";
/*
* Hacker News - http://news.ycombinator.com/news
*/
.title {
font-size: 16px !important;
}
.subtext {
font-size: 12px !important;