Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
tkuchiki / golang.spec
Created October 6, 2015 13:03
golang.spec
Name: golang
Version: 1.5.1
Release: 1%{?dist}
Summary: The Go Programming Language
License: BSD
URL: http://golang.org
Source0: https://storage.googleapis.com/golang/go%{version}.linux-amd64.tar.gz
AutoReqProv: no
%define __spec_install_post %{nil}
@tkuchiki
tkuchiki / gaurun.spec
Last active November 16, 2016 04:07
gaurun.spec
Summary: A general push notification server in Go
Name: gaurun
Version: 0.4.0
Release: 1%{?dist}
License: MIT
Group: Applications/Services
URL: https://github.com/mercari/gaurun
Source: https://github.com/mercari/gaurun/archive/v%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: make
@tkuchiki
tkuchiki / tcpstat.spec
Created October 1, 2015 03:55
tcpstat.spec
Summary: Reports certain network interface statistics
Name: tcpstat
Version: 1.5
Release: 1%{?dist}
License: NSD
Group: Applications/Internet
URL: http://www.frenchfries.net/paul/tcpstat/
Source: http://www.frenchfries.net/paul/tcpstat/tcpstat-%{version}.tar.gz
BuildRequires: libpcap-devel
%ifarch i386
%define arch i386
%else
%define arch amd64
%endif
Summary: A fast and powerful open source alternative to grep
Name: sift
Version: 0.3.2
Release: 1%{?dist}
License: GPLv3
@tkuchiki
tkuchiki / _setup.sh
Last active September 5, 2015 08:31
isucon4 ubuntu
apt-get update
apt-get remove -y nano
echo "mysql-server-5.5 mysql-server/root_password password isucon" | debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password_again password isucon" | debconf-set-selections
apt-get install -y mysql-server mysql-common mysql-client
mysql -u root --password=isucon -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');"
mysql -u root -e "GRANT ALL PRIVILEGES ON isu4_qualifier.* TO isucon@localhost IDENTIFIED BY 'isucon' WITH GRANT OPTION"
apt-get install -y nginx
apt-get install -y build-essential libxml2-dev libmysqld-dev libssl-dev libreadline-dev pkg-config vim curl git
@tkuchiki
tkuchiki / Vagrantfile
Last active August 28, 2015 03:42
CentOS6 に zabbix-server を入れる
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "centos6.6"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048", "--cpus", "2", "--ioapic", "on"]
end
config.vm.network :forwarded_port, guest: 80, host: 8080
end
@tkuchiki
tkuchiki / cgroup.sh
Last active August 29, 2015 14:27
cgroups で制限をかけるラッパースクリプト
#!/bin/bash
USER=$(whoami)
GROUP=$(id --group --name)
sudo cgcreate -t ${USER}:${GROUP} -a ${USER}:${GROUP} -g cpu,memory:/${USER}
FREE_MEM=$(free -b | grep 'buffers/cache' | awk '{print $4}')
MEM=$(perl -MPOSIX -e "print POSIX::floor(${FREE_MEM} * 0.1);")
cgset -r memory.limit_in_bytes="${MEM}" ${USER}
cgset -r cpu.cfs_quota_us=50000 ${USER}
@tkuchiki
tkuchiki / check_spot_instance_status.sh
Last active August 29, 2015 14:26
(自分自身の) spot instance が status cancelled で動いたままかチェックする
[ -n "$(aws ec2 describe-spot-instance-requests --filters Name=status-code,Values=request-canceled-and-instance-running Name=instance-id,Values=$(curl -s 169.254.169.254/latest/meta-data/instance-id) | jq .SpotInstanceRequests[])" ]
@tkuchiki
tkuchiki / chef-server.md
Last active August 29, 2015 14:25
Chef Server 12
yum install -y https://web-dl.packagecloud.io/chef/stable/packages/el/6/chef-server-core-12.1.2-1.el6.x86_64.rpm
chef-server-ctl reconfigure
# chef-server-ctl user-create knife chef node [email protected] password --filename /etc/chef/knife.pem
# chef-server-ctl org-create chef "Chef" --association knife --filename /etc/chef/chef-validator.pem
@tkuchiki
tkuchiki / gearmand.spec
Last active August 29, 2015 14:23
install gearmand 1.1.12 for Amazon Linux 2015.03
Summary: Gearman Server and C Library
Name: gearmand
Version: 1.1.12
Release: 2
License: BSD
Group: System Environment/Libraries
BuildRequires: bison
URL: http://launchpad.net/gearmand
Requires: sqlite, libevent >= 1.4, boost-program-options >= 1.39
Requires: boost-devel