Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
tkuchiki / config.xml
Created October 24, 2013 12:15
jenkins config.xml
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.0</version>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity><!-- セキュリティ有効化 -->
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"/>
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
<disableSignup>true</disableSignup><!-- ユーザにサインアップを許可 -->
@tkuchiki
tkuchiki / jq.md
Last active July 14, 2021 08:34
example of jq

JSON to LTSV

jq -r '.[] | to_entries | map("\(.key):\(.value)") | join("\t")'

aws ec2 describe-instances の Tags に特定の文字列が含まれている PrivateIP のみ出力する

Tags がないとき用に .Tags[]? にしておく

#!/usr/bin/env ruby
require 'time'
require 'optparse'
in_delim = "\t"
out_delim = "\t"
f = nil
opt = OptionParser.new
@tkuchiki
tkuchiki / Kohana with nginx
Last active February 17, 2021 19:41
Kohana nginx configuration
server {
listen 80;
server_name example.com;
access_log /path/to/access.log main;
error_log /path/to/error.log;
root /path/to/kohana/web;
location / {
index index.php;
if (-f $request_filename) {
@tkuchiki
tkuchiki / install_mysql8_ubuntu.sh
Created August 29, 2020 12:40
Install mysql 8.0 on ubuntu 18.04
#!/bin/bash
apt-get update
apt-get install -y debconf libaio1 apparmor-profiles lsb-release gnupg
DEB="/tmp/mysql.deb"
ROOT_PASSWORD=""
MYSQL_USER="testuser"
MYSQL_PASSWORD="testpass"
@tkuchiki
tkuchiki / _memo.md
Last active August 11, 2020 15:28
Recursive PURGE from BASE URL for Fastly

Requirements

  • wget
  • curl

Usage

$ bash fastly-recursive-purge.sh https://example.com
@tkuchiki
tkuchiki / memo.md
Last active July 22, 2020 08:38
Jenkins の実行ユーザを変更する

実行ユーザ変更

/etc/sysconfig/jenkins

JENKINS_USER="USER"

を設定

@tkuchiki
tkuchiki / data.tf
Last active July 17, 2020 02:20
terraform の external data source を使って外部コマンドの実行結果を variable として使用する
variable "foo" {
type = "string"
default = "baz"
}
data "external" "example" {
program = ["bash", "test.sh"]
query = {
foo = "${var.foo}"
@tkuchiki
tkuchiki / memo.md
Created July 17, 2019 02:31
Show HTTP status code constants for Go(net/http)
$ go doc -all net/http | awk '$1 ~ /Status/ && $2 == "=" {print}' | awk '{print $3, $1}'
100 StatusContinue
101 StatusSwitchingProtocols
102 StatusProcessing
200 StatusOK
201 StatusCreated
202 StatusAccepted
203 StatusNonAuthoritativeInfo
204 StatusNoContent
@tkuchiki
tkuchiki / example.md
Last active May 2, 2020 23:50
s3 にアップロードする (golang)
$ ./put-s3 --help
sage: put-s3 --file=FILE --bucket=BUCKET --region=REGION [<flags>]

Flags:
      --help                 Show context-sensitive help (also try --help-long and --help-man).
  -f, --file=FILE            upload file
  -b, --bucket=BUCKET        bucket
  -r, --region=REGION        region
 --path=PATH path