Skip to content

Instantly share code, notes, and snippets.

@onigra
onigra / func.zsh
Created February 7, 2019 06:52
remote branch checkout
function gcp() {
local res
local branch=$(git branch -a | peco | tr -d ' ')
if [ -n "$branch" ]; then
if [[ "$branch" =~ "remotes/" ]]; then
local b=$(echo $branch | cut -d '/' -f 3-)
res="git checkout -b ${b} ${branch}"
else
res="git checkout ${branch}"
@onigra
onigra / remove_arifacts.sh
Created December 25, 2018 09:45
remove artifacts
aws s3 ls \
s3://bucket/artifacts \
--recursive \
--human-readable | \
grep manifest.yml | \
sort -r | \
tail -n+20 | \
awk -F ' ' '{ print $5 }' | \
sed -e 's/\(artifacts\/.*\)\/namespace\/manifest\.yml/s3:\/\/bucket\/\1/g' | \
xargs -I{} aws s3 rm --recursive "{}"
@onigra
onigra / async.js
Created December 13, 2018 15:15
js async function
const http = require("http");
const util = require("util");
function post(payload) {
return new Promise((resolve, reject) => {
const options = {
method: "POST",
hostname: "httpbin.org",
port: 80,
path: "/post"
@onigra
onigra / script.rb
Last active March 18, 2018 07:06
動的にec2のipを取得する
require 'aws-sdk'
credentials = Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
ec2 = Aws::EC2::Client.new(region: ENV['AWS_DEFAULT_REGION'], credentials: credentials)
res = ec2.describe_instances(
{
filters: [
{
name: "tag:Environment",
@onigra
onigra / companies.md
Created January 22, 2018 05:03 — forked from okohs/whitelist.md
20180122_定時前に帰宅できた企業

書き方

該当する各社の対応欄に企業名を書いてください。備考があれば適宜カッコ書きしてください。

出勤していない(終日在宅勤務含む)

早めに退勤できた

  • 株式会社アイスタイル
  • 株式会社エスエムエス
@onigra
onigra / git-option-normalization.sh
Created November 25, 2017 16:25
git option normalization sample
#!/usr/local/bin/bash
#
# https://git-scm.com/docs/git-rev-parse#_parseopt
# https://github.com/git/git/blob/master/git-sh-setup.sh#L81L85
# https://twitter.com/sngworks/status/933953271487610880
# https://twitter.com/onigra_/status/934453258688479232
#
GIT_REBASE_OPTIONS_SPEC="
git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]
@onigra
onigra / slack.json
Created September 13, 2017 11:01
Karabiner-Elementsで option + a で 未読チャネルにジャンプする
{
"title": "For Slack option + a move unread channel",
"rules": [
{
"description": "Remap left_option + left_shift + down_arrow to left_option + a",
"manipulators": [
{
"from": {
"key_code": "a",
"modifiers": {
@onigra
onigra / italic-emoji-test.md
Last active September 13, 2017 03:00
italic-emoji test
:thinking_face:
_:thinking_face:_
_foobar :thinking_face: _

🤔
🤔
foobar 🤔

@onigra
onigra / from-coach.md
Created March 30, 2017 05:42
RailsGIrlsのコーチよりカンペ

それぞれのコマンドが何なのか説明してみましょう。何が生成されましたか?そしてサーバーは何をしますか?

mkdir projects
cd projects
rails new railsgirls
cd railsgirls
rails server
@onigra
onigra / atom-memo.md
Last active March 24, 2017 14:15
Atomメモ

プラグイン

  • ターミナルエミュレータ
    • term3
  • git
    • git-plus
    • git-log
    • tree-view-git-status
  • ブラウザ
  • browser-plus