Skip to content

Instantly share code, notes, and snippets.

View pyohei's full-sized avatar

Shohei Mukai pyohei

View GitHub Profile
@pyohei
pyohei / circleci_webhook_delete.sh
Last active December 1, 2020 08:44
Delete Old Circle CI webhook url.
#!/bin/bash
VSC=github
ORG=xxxxxxxx
CIRCLE_TOKEN=xxxxxxxxx
CIRCLE_API_BASE=https://circleci.com/api/v1.1
REPOSITORIES=`curl -s ${CIRCLE_API_BASE}/projects -H "Circle-Token: ${CIRCLE_TOKEN}" | grep "reponame" | cut -d '"' -f 4`
# Update webhook url
@pyohei
pyohei / django_extract_urls.py
Created July 16, 2019 09:36
djangoのURLの一覧を取得して、別のURLと比較するスクリプト。
"""URLの一覧を抽出するスクリプト
簡易的に作成したものなので、コンテナの中に入って直接実行する必要がある。
PYTHONPATHなどを事前に通しておけば、コンテナ外からも動作する可能性はある。
"""
from collections import OrderedDict
import django; django.setup()
from backoffice.coke import urls
@pyohei
pyohei / partition.py
Created March 2, 2019 08:48
Separate combined text file.
"""This text contain `----fileName` as break point."""
FILE_NAME = 'all.txt'
with open(FILE_NAME, mode='r') as f:
_f = None
for line in f.readlines():
if line.startswith('----'):
if _f:
_f.close()
_file_name = line.lstrip('-').rstrip('\r\n')
@pyohei
pyohei / pypi_upload.sh
Created June 6, 2018 11:38
The way to upload pypi
# Need to install twine
python setup.py sdist
twine upload dist/*
@pyohei
pyohei / iTunesMusicCopy.sh
Last active February 16, 2020 22:55
Copy iTunes Music into iCloud drive directory.
#!/bin/sh
#
# Copy iTunes Music data into iCloud drive.
# This script placed on https://gist.github.com/pyohei/2a5fe506be29e07b89428198268be4dc
# If you modify, you reflect it on the upper gist!!
#
# Licence: MIT
ICLOUD_DIR="/Users/${USER}/Library/Mobile Documents/com~apple~CloudDocs"
@pyohei
pyohei / install_mackerel_in_rapsberry_pi-ja.md
Last active November 5, 2017 00:14
Install mackerel agent in Raspberry Pi

最新のARM版mackerel-agentをダウンロード

# URLが最新かどうかはチェックするように
wget https://github.com/mackerelio/mackerel-agent/releases/download/v0.30.2/mackerel-agent_linux_arm.tar.gz
tar xzfv mackerel-agent_linux_arm.tar.gz
cd mackerel-agent_linux_arm.tar

設定ファイルの編集

# `# apikey = ""` となっている部分にAPIKEY(Makerelで取得可能)を入れコメントを外す。

2015-12-06 作成

AWSサービス一覧

目的

  • AWSのサービスの概要を理解する

サービス一覧

コンピューティング

@pyohei
pyohei / accessBigquery.go
Created July 22, 2017 10:15
Access BigQuery with service account (golang).
//This is sample source code.
package main
import (
"cloud.google.com/go/bigquery"
"fmt"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
bq "google.golang.org/api/bigquery/v2"
"google.golang.org/api/iterator"
@pyohei
pyohei / file_diff.sh
Created May 14, 2017 13:33
look file diff as
#!/bin/sh
# You should language as english
# LANG=C
# Export new files or directories
diff -rq a b | grep "Only in" | cut -d":" -f2 | tr -d " " > new.txt
# Export diff files
diff -rq a b | grep "Files" | grep "differ" | cut -d " " -f2 > diff.txt
@pyohei
pyohei / gitcd.bat
Created March 26, 2017 11:33 — forked from mattn/gitcd.bat
@echo off
chdir %*
set BRANCH=
for /f "eol=; tokens=1,2 delims== " %%i in ('"git branch 2>NUL"') do if "%%i"=="*" set BRANCH=%%j
if "%BRANCH%" neq "" (
set PROMPT=$P^(%BRANCH%^)$G
) else (
set PROMPT=$P$G
)