Skip to content

Instantly share code, notes, and snippets.


kimihiro_n pistatium

View GitHub Profile
pistatium /
Created Jan 7, 2020
import base64
import random, string
def b64(s):
return (base64.b64encode(s.encode())).decode()
def rnd():
return ''.join(random.choices(string.punctuation + string.ascii_letters, k=7))
while True:
pistatium / immutable_python.ipynb
Last active Dec 19, 2019
Immutable Python スクリプト
View immutable_python.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
pistatium /
Created Dec 10, 2019
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
flames = []
# 投票ラベル ('A': 1, 'B': 2, 'C': 3) に対応
labels = ['A', 'B', 'C']
from import Team
from pongpy.models.game_info import GameInfo
from pongpy.models.state import State
class MyTeam(Team):
""" """
def name(self) -> str:
return 'myteam'
pistatium /
Last active Nov 28, 2018
任意の Slack チャンネルにメールを飛ばすための Lambda スクリプト

任意のチャンネルでメールを受信できるようにするための AWS Lambda(Python) スクリプトです。

説明リンク: TBD

pistatium /
Last active Sep 28, 2018
import os
import boto3
from collections import defaultdict
CLUSTER = os.environ.get('TARGET_CLUSTER')
ecs = boto3.client('ecs')
token = ''
cpus = defaultdict(int)
pistatium / commit-msg
Created Apr 5, 2018
コミットメッセージの先頭に絵文字がないと失敗するgit hook
View commit-msg
msg=`cat "$1"`
if [[ "$msg" =~ ^[^:] ]]; then
echo >&2 Commit message is not starting emoji.
exit 1
# emojify 後と比較して変わってなければ不正な絵文字
pistatium / hatena_html_bookmarklet.js
Last active Feb 7, 2017
Hatena embed bookmarklet
View hatena_html_bookmarklet.js
javascript:prompt('URL ForHatena Blog embed','<iframe frameborder="0" height="150" scrolling="no" src="//'+location.href+'" style="width:100%;height:155px;margin:0 0 20px 0;display:block;" width="300"></iframe>')();
from datetime import timedelta, datetime
from django.utils import timezone
from django.test import TestCase
from django import template
register = template.Library()
def timeago(dt: datetime, now_dt: datetime=None) -> str:
pistatium / exercise-equivalent-binary-tree.go
Last active Jan 28, 2016
Exercise: Equivalent Binary Trees
View exercise-equivalent-binary-tree.go
package main
import (
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {