Skip to content

Instantly share code, notes, and snippets.

Avatar

utagawa kiki utgwkk

View GitHub Profile
@utgwkk
utgwkk / nippo.py
Last active Jan 14, 2019
日報を書くように促してくれるSlack incoming webhook氏
View nippo.py
#!/usr/bin/python3
import subprocess
import json
import urllib.parse
from datetime import date
PROJECT_NAME = 'your-project-name'
WEBHOOK_URL = 'SLACK_INCOMING_WEBHOOK_URL'
def to_ja_week(week_num: int) -> str:
View relationship.py
#!/usr/bin/env python3
import itertools
import sys
users = [x.rstrip() for x in sys.stdin.readlines()]
result = "(" + " OR ".join(map(lambda x: "from:" + x, users)) + " exclude:replies) OR "
pairs = []
@utgwkk
utgwkk / rorotoro.py
Created Sep 23, 2018
H_na_rorotoroガチャ
View rorotoro.py
import random
import itertools
def rorotoro():
for ro in range(1, 5):
to = 4 - ro
for rorotoro in itertools.permutations((['ro'] * ro) + (['to'] * to)):
yield ''.join(rorotoro)
def h_na_rorotoro(num_min_underscores=1, num_max_underscores=30):
@utgwkk
utgwkk / closure.py
Created Jul 11, 2018
Calculating closure of functional dependencies
View closure.py
fds = {
('A', 'B'),
('A', 'G'),
('B', 'C'),
('C', 'D'),
('BC', 'E'),
('CG', 'A'),
}
start = 'B'
View emoji.mysql
-- MySQL dump 10.13 Distrib 5.7.21, for Linux (x86_64)
--
-- Host: localhost Database: sandbox
-- ------------------------------------------------------
-- Server version 5.7.21
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
@utgwkk
utgwkk / fib.c
Created Feb 12, 2018
fib(38) を求めるCプログラム
View fib.c
#include <stdio.h>
#include <stdlib.h>
extern void start_timer();
extern void stop_timer();
typedef union MLType {
int value;
union MLType (*func)(union MLType, union MLType);
union MLType *tuple;
} _t;
@utgwkk
utgwkk / conv.py
Created Feb 10, 2018
カレントディレクトリのMP3のファイル名を,ID3をもとに変更するスクリプト
View conv.py
"""
You have to `pip install mutagen` before executing this script
"""
import os
from glob import glob
from mutagen.easyid3 import EasyID3
for idx, path in enumerate(glob('*.mp3')):
tags = EasyID3(path)
new_path = '%02d - %s.mp3' % (idx + 1, tags['title'][0])
@utgwkk
utgwkk / fib.c
Created Jan 17, 2018
10! を求めるCプログラム
View fib.c
#include <stdio.h>
#include <stdlib.h>
union MLType {
int value;
union MLType (*func)(union MLType, union MLType);
union MLType *tuple;
};
typedef union MLType _t;
View keybase.md

Keybase proof

I hereby claim:

  • I am utgwkk on github.
  • I am utgwkk (https://keybase.io/utgwkk) on keybase.
  • I have a public key whose fingerprint is 246F 563A 4426 4BC1 E635 80BD F1E6 21A1 51D6 1491

To claim this, I am signing this object:

@utgwkk
utgwkk / mysql-accumlate.md
Last active Jan 15, 2022
詳説 MySQLで累積和を求める方法
View mysql-accumlate.md

MySQL で累積和を求める方法

SELECT
    t1.accum_date
 , t1.count