Skip to content

Instantly share code, notes, and snippets.

@namutaka
namutaka / slack_verify_request.lua
Created July 15, 2019 10:40
Slack Verifying request by nginx + lua
--
-- Slack Verifying request filter
-- see: https://api.slack.com/docs/verifying-requests-from-slack
--
-- Setup:
-- cd /path/to/lua
-- curl -sL https://github.com/jkeys089/lua-resty-hmac/archive/master.tar.gz | tar zxf -
--
-- Usage:
-- ```nginx.conf
@namutaka
namutaka / terraform.debug.log
Created May 21, 2019 07:22
Terraform debug log for terraform issue
% TF_LOG=trace terraform init
2019/05/21 16:17:56 [INFO] Terraform version: 0.12.0 rc1
2019/05/21 16:17:56 [INFO] Go runtime version: go1.12.1
2019/05/21 16:17:56 [INFO] CLI args: []string{"/Users/namutaka/local/bin/terraform", "init"}
2019/05/21 16:17:56 [DEBUG] Attempting to open CLI config file: /Users/namutaka/.terraformrc
2019/05/21 16:17:56 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/05/21 16:17:56 [INFO] CLI command args: []string{"init"}
2019/05/21 16:17:56 [TRACE] ModuleInstaller: installing child modules for . into .terraform/modules
Initializing modules...
2019/05/21 16:17:56 [DEBUG] Module installer: begin sample
@namutaka
namutaka / swagger_to_es_filter_json.rb
Created October 13, 2017 04:07
swaggerからAPI定義を読み取ってelastic searchの検索filter条件式を作成する
#!/bin/env ruby
# encoding: utf-8
#
# SwaggerからURLとmethodの定義を取得して
# Elastic Serch(kibana)の検索条件式のJSONを出力します
#
require 'json'
require 'open-uri'
@namutaka
namutaka / ivy_cache_to_local.py
Last active May 22, 2017 03:09
ivyのcacheをlocalに変換してリポジトリとして使う
#!/usr/bin/python
# -*- conding: utf-8 -*-
#
# copy ivy cache to local
#
import sys
import os
import re
import glob
@namutaka
namutaka / applicationContext.xml
Created March 25, 2016 14:43
use system properties in spring
<beans>
<context:property-placeholder
location="classpath*:config-${my.env}.properties"
order="1"
ignore-unresolvable="true"
/>
</beans>
@namutaka
namutaka / Gruntfile.js
Created January 1, 2015 11:45
Grunt browserify sample
// @file Gruntfile.js
// https://github.com/yeoman/generator-angular/blob/master/templates/common/root/_Gruntfile.js
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// https://github.com/jmreidy/grunt-browserify/tree/master/examples/basic
browserify : { // タスク名. $ grunt browserify で実行できる
@namutaka
namutaka / JDBCMetaDataTest.scala
Created December 15, 2014 11:13
Retrieve database meta data from JDBC drivers.
import scalikejdbc._
import java.util.Locale.{ ENGLISH => en }
object JDBCMetaDataTest extends Settings {
GlobalSettings.loggingSQLAndTime = new LoggingSQLAndTimeSettings(
enabled = true,
singleLineMode = true,
logLevel = 'DEBUG
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`
@namutaka
namutaka / tmux_attach.sh
Created January 30, 2014 01:34
tmux attash command
function tm {
tmux has -t main 2> /dev/null
if [ "$?" -eq 0 ]; then
exec tmux attach -t main
else
exec tmux new -s main
fi
}
@namutaka
namutaka / changeGraphColor.bas
Created November 6, 2013 10:25
PowerPointの埋め込みグラフの色を一括で変更するVBAマクロ
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public BorderColor As Integer, MarkerColor As Integer
'
' スライド全体の埋め込みグラフの色を1つ目のグラフに合わせて変更します
' MacではGraph編集機能の起動・終了のタイミングがあわず
' 上手く処理できないグラフが出ることがあります
'
Sub changeGraphColor()
BorderColor = -1