Skip to content

Instantly share code, notes, and snippets.

View lorentzca's full-sized avatar
🏕️
In the Woods.

Kohta Kunishima lorentzca

🏕️
In the Woods.
View GitHub Profile
@lorentzca
lorentzca / twitter-trends.rb
Created August 26, 2015 15:21
日本のトレンドのワードを1つだけ返す
@lorentzca
lorentzca / what_is_my_mac_model_number.rb
Created August 21, 2015 01:59
what is my mac model number?
#!/usr/bin/env ruby
mode_identifier = `system_profiler SPHardwareDataType | awk '/Model Identifier:/ {print $3}'`
`open http://www.everymac.com/ultimate-mac-lookup/?search_keywords=#{mode_identifier}`
@lorentzca
lorentzca / w9n.rb
Last active September 15, 2015 07:08
what quarter now
#!/usr/bin/env ruby
def what_quarter_now
month = Time.now.strftime("%-m")
if month == 6 || 7 || 8
puts "1Q"
elsif month == 9 || 10 || 11
puts "2Q"
elsif month == 12 || 1 || 2
@lorentzca
lorentzca / mha
Last active August 29, 2015 14:16
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define 'manager' do |manager|
manager.vm.box = "chef/centos-5.11"
manager.vm.network 'private_network', ip: '192.168.44.10'
manager.cache.scope = :box if Vagrant.has_plugin? 'vagrant-cachier'
manager.vm.provision "shell", inline: <<-SHELL
sudo hostname manager
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "chef/centos-7.0"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision "shell", inline: <<-SHELL
sudo yum update -y
sudo yum install -y \
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "chef/ubuntu-12.04"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update -y
sudo apt-get install -y curl
on run argv
tell application "iTunes"
set command to first item of argv
if command = "play" then
play
else if command = "pause" then
pause
else if command = "next" then
next track
else if command = "prev" then
@lorentzca
lorentzca / install_elasticsearch_and_kibana.sh
Last active August 29, 2015 14:10
elasticsearch and kibana
#!/bin/bash
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 9200 -j ACCEPT
yum install -y java-1.7.0-openjdk wget unzip
rpm -ivh https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.2.noarch.rpm
chkconfig --add elasticsearch
yum install -y httpd
@lorentzca
lorentzca / initializer.sh
Created December 7, 2014 16:29
update system, initialize disk and swap
#!/bin/bash
yum update -y
resize2fs -p /dev/xvde
mkdir /mnt/store_vol
mount /dev/xvdf /mnt/store_vol/
dd if=/dev/zero of=/mnt/store_vol/swapfile bs=1M count=1024
mkswap /mnt/store_vol/swapfile
swapon /mnt/store_vol/swapfile
@lorentzca
lorentzca / wercker.yml
Last active August 29, 2015 14:02
werckerで使うやつ
box: wercker/ruby
build:
steps:
- script:
name: make .ssh directory
code: mkdir -p $HOME/.ssh
- create-file:
name: put ssh public key
filename: $HOME/.ssh/id_rsa.pub