Skip to content

Instantly share code, notes, and snippets.

Kenji Naito kenjiskywalker

Block or report user

Report or block kenjiskywalker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kenjiskywalker
kenjiskywalker / netatmo.rb
Last active Jun 27, 2017
NetatmoのAPIを利用してSlackに通知する
View netatmo.rb
#!/usr/bin/env ruby
require 'net/https'
require 'json'
require 'uri'
require 'pp'
@netatmo_config = {
client_id: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
client_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
View 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 Dec 18, 2016 — forked from ijin/s3_sync_and_notify.sh
Sync to S3 and notify via Slack
View s3_sync_and_notify.sh
#!/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 Nov 25, 2016 — forked from goldeneggg/cmd_entrypoint.md
Dockerfileの CMD と ENTRYPOINT の挙動の違いメモ
View cmd_entrypoint.md

CMDとENTRYPOINTの違いと、使用例

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

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

CMD 使用時

  • Dockerfile
@kenjiskywalker
kenjiskywalker / op2hg.rb
Last active Oct 11, 2016
To Hugo from Octpress adapt content dirs.
View op2hg.rb
#/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' {} \;
View main.go
package main
import (
"bytes"
"fmt"
"html/template"
)
func main() {
type PersonalData struct {
@kenjiskywalker
kenjiskywalker / zip.go
Last active Jul 20, 2016
Goのzipのメモ
View zip.go
package main
import (
"archive/zip"
"os"
"path"
"github.com/k0kubun/pp"
)
View ruboty-test.rb
module Ruboty
module Handlers
class Test < Base
on(
/test\z/i, # "@ellen ping"に反応して
name: "test", # #pingメソッドが呼ばれる
description: "TTT" # これは"@ellen help"でhelpを表示したとき説明文として表示される
)
def test(message)
View struct_vs_hash.rb
#!/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}
You can’t perform that action at this time.