Skip to content

Instantly share code, notes, and snippets.

@kenjiskywalker
kenjiskywalker / netatmo.rb
Last active June 27, 2017 07:58
NetatmoのAPIを利用してSlackに通知する
#!/usr/bin/env ruby
require 'net/https'
require 'json'
require 'uri'
require 'pp'
@netatmo_config = {
client_id: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
client_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
@kenjiskywalker
kenjiskywalker / ffmpeg_install.sh
Last active December 27, 2016 09:22 — forked from nekojaxa/ffmpeg_install.sh
ffmpeg_install.sh
#!/bin/sh
sudo yum -y install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir /tmp
#Yasm
cd /tmp
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
@kenjiskywalker
kenjiskywalker / s3_sync_and_notify.sh
Last active December 18, 2016 06:13 — forked from ijin/s3_sync_and_notify.sh
Sync to S3 and notify via Slack
#!/bin/bash
set -x
export SHA1=`echo ${CIRCLE_SHA1} | cut -c1-7`
# 引数で配布先のbucketを分けたい
if [ $#$ -ne 1 ]; then
export SL_COLOR="danger"
export SL_TEXT="Sync failure: Not enough args in CircleCI: $S3 - ${CIRCLE_BRANCH} (<${CIRCLE_COMPARE_URL}|${SHA1}>) by ${CIRCLE_USERNAME} !!"
export SL_ICON="http://cdn.dev.classmethod.jp/wp-content/uploads/2014/05/aws_icon-s3_white-200x200.png"
@kenjiskywalker
kenjiskywalker / cmd_entrypoint.md
Created November 25, 2016 06:33 — forked from goldeneggg/cmd_entrypoint.md
Dockerfileの CMD と ENTRYPOINT の挙動の違いメモ

CMDとENTRYPOINTの違いと、使用例

  • ざっくり概要として、CMDとENTRYPOINT どちらを使うかによって docker run CONTAINER_ID <command> した際の<command>が及ぼす影響 が変わる

CMD, ENTRYPOINTで オプションなしのコマンド を記述した場合

CMD 使用時

  • Dockerfile
@kenjiskywalker
kenjiskywalker / op2hg.rb
Last active October 11, 2016 07:46
To Hugo from Octpress adapt content dirs.
#/usr/bin/env ruby
require 'fileutils'
DIR = "./content/post/"
Dir.chdir(DIR)
# FIX: date format
# find ./content/post/ -type f -exec sed -i "" -e 's/date: \([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\) \([0-9]\{2\}:[0-9]\{2\}\).*$/date: \1T\2:00+09:00/g' {} \;
package main
import (
"bytes"
"fmt"
"html/template"
)
func main() {
type PersonalData struct {
@kenjiskywalker
kenjiskywalker / zip.go
Last active July 20, 2016 07:36
Goのzipのメモ
package main
import (
"archive/zip"
"os"
"path"
"github.com/k0kubun/pp"
)
module Ruboty
module Handlers
class Test < Base
on(
/test\z/i, # "@ellen ping"に反応して
name: "test", # #pingメソッドが呼ばれる
description: "TTT" # これは"@ellen help"でhelpを表示したとき説明文として表示される
)
def test(message)
#!/usr/bin/env ruby
require 'benchmark'
# Struct
s = Struct.new(:foo, :bar, :baz)
s = s.new(nil, nil, nil)
# Hash
h = {foo: nil, bar: nil, baz: nil}