Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲
Cycling

kimihiro_n pistatium

🚲
Cycling
View GitHub Profile
@pistatium
pistatium / seek.py
Created Jan 7, 2020
BASE64エンコードで記号三種が含まれてる文字列を探す
View seek.py
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
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
pistatium / animation_graph.py
Created Dec 10, 2019
投票の様子をグラフ化するスクリプト
View animation_graph.py
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']
View my_team.py
from pongpy.interfaces.team import Team
from pongpy.models.game_info import GameInfo
from pongpy.models.state import State
class MyTeam(Team):
""" https://github.com/pistatium/pong """
@property
def name(self) -> str:
return 'myteam'
@pistatium
pistatium / lambda_email_to_slack.md
Last active Nov 28, 2018
任意の Slack チャンネルにメールを飛ばすための Lambda スクリプト
View lambda_email_to_slack.md

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

説明リンク: TBD

@pistatium
pistatium / ecs_cpu_analyzer.py
Last active Sep 28, 2018
ECSクラスタのCPU予約量をタスクごとに集計するやーつ
View ecs_cpu_analyzer.py
import os
import boto3
from collections import defaultdict
CLUSTER = os.environ.get('TARGET_CLUSTER')
ecs = boto3.client('ecs')
token = ''
cpus = defaultdict(int)
@pistatium
pistatium / commit-msg
Created Apr 5, 2018
コミットメッセージの先頭に絵文字がないと失敗するgit hook
View commit-msg
#!/bin/bash
msg=`cat "$1"`
if [[ "$msg" =~ ^[^:] ]]; then
echo >&2 Commit message is not starting emoji.
exit 1
fi
# emojify 後と比較して変わってなければ不正な絵文字
@pistatium
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="//hatenablog-parts.com/embed?url='+location.href+'" style="width:100%;height:155px;margin:0 0 20px 0;display:block;" width="300"></iframe>')();
View timeago.py
from datetime import timedelta, datetime
from django.utils import timezone
from django.test import TestCase
from django import template
register = template.Library()
@register.filter()
def timeago(dt: datetime, now_dt: datetime=None) -> str:
@pistatium
pistatium / exercise-equivalent-binary-tree.go
Last active Jan 28, 2016
Exercise: Equivalent Binary Trees
View exercise-equivalent-binary-tree.go
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {