Skip to content

Instantly share code, notes, and snippets.

View Kuchitama's full-sized avatar
:octocat:

Kuchitama Kuchitama

:octocat:
  • Monstar Lab
  • Osaka
View GitHub Profile
@Kuchitama
Kuchitama / digdag_redume.sh
Created December 10, 2019 07:53
digdag scripts
#!/bin/bash
DIGDAG=~/bin/digdag
# see https://github.com/treasure-data/digdag/blob/v0.9.27/digdag-cli/src/main/java/io/digdag/cli/client/ShowAttempts.java#L83-L95
last_result=$($DIGDAG attempts 2>&1 | tail -13);
if [[ $last_result =~ ^.+attempt[[:space:]]id:[[:space:]]([0-9]+).+$ ]];
then
attempt_id=${BASH_REMATCH[1]};
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-27ce4931"
instance_type = "t1.micro"
}
node {
stage('dump redash postgre') {
sh '''
cid=`/usr/local/bin/docker ps | grep redash_postgres | /usr/bin/awk '{print $1}'`
if [ -z "${cid}" ]
then
return 1;
else
ts=`date +%Y%m%d`
/usr/local/bin/docker exec ${cid} /bin/bash -c 'pg_dump -U postgres postgres | gzip > /usr/local/redash.gz'
object Main extends App{
/******************
* val : immutable valuable
******************/
val one: Int = 1
println(s"one is ${one}")
val two = 2
println(s"two is ${two}")
object Main extends App{
/**********
* define methd
**********/
def plus(a: Int, b: Int): Int = {
a + b
}
// no arguments
object Main extends App{
// Here your code !
println("Hello world")
}
@Kuchitama
Kuchitama / Gemfile
Last active March 5, 2016 13:44
#rubykansai 第71回のハンズオンでやった Stackを実装する課題をなんとなくイミュータブルに実装してみた
ruby "2.3.0"
gem "test-unit"
function global:prompt {
$now = Get-Date -format "yyyy/MM/dd HH:mm"
Write-Host($now + " ") -nonewline
return "> "
}
@Kuchitama
Kuchitama / _install_nginx_by_ansible.sh
Last active July 21, 2016 02:42
Sample Playbook to install Nginx from source. Details -> http://tech.furyu.jp/blog/?p=2684
# 以下のコマンドで本番環境用のサーバ構築が実行されます
ansible-playbook -i hosts nginx.yml --extra-vars="server_name=product worker_processes=2" -k
# 開発環境サーバ構築はこちら
ansible-playbook -i hosts nginx.yml --extra-vars="server_name=product worker_processes=2" -k
@Kuchitama
Kuchitama / __init__.py
Last active December 17, 2015 04:08
Sample of Fabric task to install Nginx
from fabric.api import env, run, local, sudo, cd
from fabric.contrib.files import exists, upload_template
from fabric.decorators import task
import java_setup
nginx_version='1.2.8'
nginx_dir = "nginx-%s" % nginx_version
nginx_url = "http://nginx.org/download/%s.tar.gz" % nginx_dir
install_dir = "/usr/local/nginx"