Skip to content

Instantly share code, notes, and snippets.

View okash1n's full-sized avatar

Shintaro Okamura okash1n

View GitHub Profile
#!/bin/bash
# init
## check OS
if [ "$(uname)" == 'Darwin' ]; then
OS='Mac'
elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
OS='Linux'
elif [ "$(expr substr $(uname -s) 1 10)" == 'MINGW32_NT' ]; then
#!/usr/bin/env bash
diskutil unMountDisk /dev/disk2
diskutil eraseDisk HFS+ USBDISK /dev/disk2
/Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USBDISK --nointeraction --downloadassets
@okash1n
okash1n / gist:fcd8c4b2cb067cf8dc33dd460de8b295
Created December 1, 2021 00:12
管理者アカウントと代理アカウントの数、無効なアカウント、ロックアウトされたアカウント、停止中のアカウントの数(日付別)
SELECT date,
accounts.num_locked_users,
accounts.num_disabled_accounts,
accounts.num_delegated_admins,
accounts.num_super_admins,
accounts.num_suspended_users,
accounts.num_users
FROM api_project_name.dataset_name.usage
WHERE accounts.num_users IS NOT NULL
ORDER BY date ASC;
@okash1n
okash1n / slack_slash_command_request_body_sample.json
Last active February 16, 2022 14:53
スラッシュコマンドのリクエストのサンプル
{
"$content-type": "application/x-www-form-urlencoded",
"$content": "*****************",
"$formdata": [
{
"key": "token",
"value": "*****************"
},
{
"key": "team_id",
@okash1n
okash1n / schema.json
Created February 16, 2022 14:52
PAでスラッシュコマンドを受け取るスキーマ
{
"type": "object",
"properties": {
"$formdata": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
{
"type": "object",
"properties": {
"$content-type": {
"type": "string"
},
"$content": {
"type": "string"
},
"$formdata": {
{
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
@okash1n
okash1n / scriptdir.sh
Created October 16, 2022 03:52
安全にスクリプト自身のディレクトリでスクリプトを実行するおまじない
#!/usr/bin/env bash
# スクリプト自身のディレクトリを確実に格納
SCRIPT_DIR=$(cd $(dirname $0); pwd)
@okash1n
okash1n / git_reset.sh
Last active April 14, 2023 15:04
Gitのローカルの現在の状態を最新として過去のコミット履歴を全て削除しリモートにプッシュする黒魔術
# 以下を実行するとローカル、リモートともに "initial commit" の1コミットだけの状態になる。
# 独立したローカルブランチ tmp を作成
git checkout --orphan tmp
# ローカルブランチ tmp に全体を add
git add .
# ローカルブランチ tmp に最初のコミット
git commit -m "initial commit"