Skip to content

Instantly share code, notes, and snippets.

View kyoro's full-sized avatar
🍷

Kyosuke INOUE kyoro

🍷
View GitHub Profile
@kyoro
kyoro / test.json
Created August 21, 2019 20:54
test
{"message":"test"}

DeployGate 運用Tips

このドキュメントでは、DeployGateを社内で運用して効率的に業務フローを回すための実践的なアイデアやTipsをまとめて行きます。

CIでのビルド成功時にDeployGateにIPA/APKファイルをアップロードする

基本的にはCIで実行するスクリプトの最後に、curlコマンドでDpeloyGate Restful APIを使ってビルドしたバイナリをPOSTするだけでOK。

Circle CIであれば、circle.ymlのdeploymentの最後に以下のように追記するだけで、ビルド成功時に自動的にバイナリをアップロードして配信することができる。 このとき、curlの-F "file=@xxx"@はよく忘れている人がいるので、忘れないようにしてください。(curlでのファイル名の指定方法です)

@kyoro
kyoro / ip_share.py
Created March 18, 2017 10:34
Send own IP address to slack channel when Linux based dev-board(like Raspberry Pi) booted.
import os, re, commands
#Slack Setting
token = "XXX"
channel = "#general"
username = "DevBoard"
icon_emoji = ":computer:"
ifconfig_res = commands.getoutput('ifconfig')
message = "IP: "
ips = re.findall('\d+\.\d+\.\d+\.\d+',ifconfig_res)
@kyoro
kyoro / nyantech_sonic_sensor_01.ino
Created January 11, 2017 08:02
にゃんてっく第3回 超音波センサーの利用
// ねこが来たとみなす距離(センチ)
#define NEARBY_DISTANCE 20
//ねこが来たと判定する検出回数(多くすると安定するが、検知しにくくなる)
#define NEARBY_TIME 15
// ピン番号設定
#define LED_PIN 4
#define TRIG_PIN 5
#define ECHO_PIN 16
@kyoro
kyoro / hue.sh
Created November 13, 2016 05:17
Turning on/off hue bulbs
#!/bin/bash
arg=$1
ip="192.168.0.2"
token="__USER_NAME__"
json='{"on":true,"hue":8500}'
if [ "${arg}" = "off" ]; then
json='{"on":false}'
fi
for n in {2,4}; do
curl -H 'Content-Type: application/json' -X PUT -d${json} http://${ip}/api/${token}/lights/${n}/state
@kyoro
kyoro / sum.rb
Created October 5, 2016 16:16
Addition without plus operator
def sum(a, b)
mask = 1
c = 0
res = 0
l = a > b ? a : b
while mask <= l || c != 0
x = mask & a
y = mask & b
r = x ^ y ^ c
c = ((x & y) | (x & c) | (y & c)) << 1
@kyoro
kyoro / file0.txt
Last active May 2, 2019 01:37
UbuntuにMosquittoをインストールしてMQTTブローカーを構築 ref: http://qiita.com/kyoro353/items/b862257086fca02d3635
kyoro@iot:~$ sudo add-apt-repository ppa:mosquitto-dev/mosquitto-ppa
[sudo] password for kyoro:
More info: https://launchpad.net/~mosquitto-dev/+archive/ubuntu/mosquitto-ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpmtjlhsxh/secring.gpg' created
gpg: keyring `/tmp/tmpmtjlhsxh/pubring.gpg' created
gpg: requesting key 262C4500 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpmtjlhsxh/trustdb.gpg: trustdb created
var mqtt = require('mqtt');
var exec = require('child_process').exec;
var client = mqtt.connect('mqtt://your-mqtt-broker.com', {});
client.on('connect', function () {
client.subscribe('meme');
});
var blackout = false;
exec('brightness 1');
@kyoro
kyoro / .vimrc
Created June 5, 2015 02:38
Minimal .vimrc
set wildmenu
set nostartofline
set visualbell
set t_vb=
set mouse=a
set ttymouse=xterm2
syntax on
highlight LineNr ctermfg=darkyellow
@kyoro
kyoro / start_apache.sh
Created February 10, 2012 08:58
Start Apache2 on Rackhub
#!/bin/bash
/etc/init.d/apache2 start