Skip to content

Instantly share code, notes, and snippets.

View yheihei's full-sized avatar

Yohei Kokubo yheihei

View GitHub Profile
@yheihei
yheihei / gist:f7673375219fadf8ab0e150c2020906c
Last active September 19, 2023 23:33
django_route_confirm.py
# Djangoの現在のurlパターンを全出力. ./manage.py shell の中で打って確認すると良い
from django.urls import get_resolver
def show_url_patterns(url_patterns, prefix=''):
for pattern in url_patterns:
if hasattr(pattern, 'url_patterns'):
show_url_patterns(pattern.url_patterns, prefix + pattern.pattern.regex.pattern)
else:
name = pattern.name or 'Unnamed'
@yheihei
yheihei / HardhatTest.js
Created August 14, 2022 09:22
hardhatを使ったテストコードのサンプル
const { expect } = require("chai");
const { ethers } = require("hardhat");
const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers");
describe("HollandGene contract", function () {
async function deployTokenFixture() {
// 1. fixture内でNFTのコントラクトを取得
const HollandGene = await ethers.getContractFactory("HollandGene");
// 2. 使用するウォレットを作成しておく(デフォルトでETHがめちゃくちゃ入っている)
@yheihei
yheihei / jira_title_copy.js
Created May 24, 2022 01:52
tampermonkey JIRAタイトルコピー
// ==UserScript==
// @name JIRA title copy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @include https://yhei-web-design.atlassian.net/browse/*
// @exclude https://yhei-web-design.atlassian.net/browse/*oldIssueView*
// @exclude https://yhei-web-design.atlassian.net/browse/*focusedCommentId*
// @grant none
@yheihei
yheihei / vscode_plugin_for_terraform.md
Last active January 27, 2022 21:33
Terraformを使うときに便利なVSCodeプラグイン
  • HachiCorp Terraform
  • Terraform Autocomplete
  • Graphviz Interactive Preview
@yheihei
yheihei / urlpatterns.py
Created January 13, 2022 07:28
djangoでurlのbasename(reverseで使うやつ)のリストを出す方法
from django.urls import get_resolver
root_resolver = get_resolver()
def _join_namespace(a, b):
return (a + ':' if a else '') + (b or '')
def _print_resolver(namespace, resolver):
_namespace = _join_namespace(namespace, resolver.namespace)
for ns, (prefix, res) in resolver.namespace_dict.items():
_print_resolver(_namespace, res)
@yheihei
yheihei / tampermonkey.js
Last active January 12, 2022 06:17
JIRAのカンバンボードにコピーボタンを追加するユーザースクリプト
// ==UserScript==
// @name カンバンでのコピーボタン挿入
// @namespace https://yhei-web-design.com
// @version 0.1
// @description JIRAのカンバンにチケットのタイトルコピーボタンを追加する
// @author yhei.register@gmail.com
// @match https://*.atlassian.net/jira/software/projects/XMAR/boards/*
// @icon https://www.google.com/s2/favicons?domain=atlassian.net
// @grant none
// ==/UserScript==
@yheihei
yheihei / get_dataframe_value.py
Last active January 7, 2022 09:30
行と列指定でデータフレームの値を取得する
import pandas as pd
df = pd.read_csv("sample.csv")
df
# 名前 メールアドレス
# 0 小久保 yheihei0126@gmail.com
# 1 ちゃた chataro@gmail.com
print(df.at[0, '名前'])
# 小久保
@yheihei
yheihei / 振り返りフォーマット.md
Created December 20, 2021 08:37
振り返りフォーマット

あなたは本当の価値を付加しているのか、それとも単に情報をあちこちへ流しているだけなのか、付加価値をどうやって高めようとしているのか

  • メンバーにクラウドプラクティショナーの勉強方法を伝授した。皆、やる気があり自主的に取って行きそうな雰囲気が出ている。インフラできる人が増えればCLPへの依存度を減らしコストを削減できる可能性がある

自分の周囲で起こっていることに対してアンテナを張り情報収拾を怠らないでいるか

  • スケジュールが安定してきており、新たにチームメンバーに流すような情報はなかった

新しいアイデアや、新しい手法や、新しい技術をいつも試みているか

  • クラウドプラクティショナーに合格。基本的なAWSのインフラ設計/構築ができるようになった
  • ElasticSearchで使うKibanaの使い方をブログにまとめた
@yheihei
yheihei / token.md
Created December 6, 2021 00:52
django ユーザーログインした後、Token使ってAPIを叩く
@yheihei
yheihei / Nuxt環境のVScodeプラグイン.md
Created December 3, 2021 03:38
Nuxt環境のおすすめVScodeプラグイン
  • Vetur
  • Auto Close Tag