Skip to content

Instantly share code, notes, and snippets.

View takehaya's full-sized avatar
🏠
Working from home

Takeru Hayasaka takehaya

🏠
Working from home
  • BBSakura Networks, Inc.
  • Tokyo Japan
  • 06:41 (UTC +09:00)
View GitHub Profile
#! /usr/bin/env python3
import sys
from zipfile import ZipFile
with ZipFile(sys.argv[1]) as zip:
for info in zip.infolist():
name = info.filename.encode('cp437').decode('cp932')
info.filename = name
print(info.filename)
import matplotlib.pyplot as plt
import numpy as np
import math
ax = plt.subplot(111, polar=True)
ax.set_theta_direction(-1)
ax.set_theta_zero_location("W")
import matplotlib.pyplot as plt
import numpy as np
import math
ax = plt.subplot(111, polar=True)
ax.set_theta_direction(-1)
ax.set_theta_zero_location("W")
# xalx = [
@takehaya
takehaya / inventry.sh
Created October 24, 2019 18:45
ansibleで使おうとしたやつ供養
#!/bin/sh
set -eu
dir=""
if [ $# -ne 1 ]; then
dir=`terraform workspace show`
fi
if [ -e ./terraform.tfstate.d/${dir}/terraform.tfstate ]; then
rm -f hosts
if [ "`uname`" == "Darwin" ]; then
Vagrant.configure("2") do |config|
config.vm.box = "higebu/vyos"
config.vm.define :vyos1 do | vyos |
vyos.vm.hostname = "vyos1"
vyos.vm.network :private_network, ip: "192.168.13.1", virtualbox__intnet: "intnet13"
vyos.vm.network :private_network, ip: "10.1.14.1", virtualbox__intnet: "intnet14"
vyos.vm.network :private_network, ip: "10.1.41.1", virtualbox__intnet: "intnet41"
end
@takehaya
takehaya / keymap.c
Created April 24, 2019 03:30
ergodash my keymap
#include QMK_KEYBOARD_H
extern keymap_config_t keymap_config;
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
#define _ADJUST 16
enum custom_keycodes {
#ifndef __BPF_HELPERS_H
#define __BPF_HELPERS_H
/* helper macro to place programs, maps, license in
* different sections in elf_bpf file. Section names
* are interpreted by elf_bpf loader
*/
#define SEC(NAME) __attribute__((section(NAME), used))
/* helper functions called from eBPF programs written in C */
@takehaya
takehaya / mem.sh
Created January 31, 2019 09:39
Max RSSを取得できる(./mem.sh <option> <知りたいprocess>)
#!/bin/sh
# mem.sh
# GNU GPL version 2 copyright@N_Nao
# オプションの取得
while getopts :M opt
do
case $opt in
"M") size_f="TRUE";; # MB表示を行う
*) error_f="TRUE";;
import numpy as np
def main():
epock_list = [
[2.8, 2.9, 3.0, 3.1, 3.2, 3.2, 3.2, 3.3, 3.4],
[30, 26, 33, 31, 33, 35, 37, 36, 33]
]
x_2_list = list(map(lambda x: round(x**2, 2), epock_list[0]))
x_y_list = list(map(lambda x, y: round(x*y, 2), epock_list[0], epock_list[1]))
print(epock_list[0], round(sum(epock_list[0]),2))
@takehaya
takehaya / self_remodeling.py
Last active June 3, 2018 07:20
みんなquine(自己言及)を選ぶので自己改造も目指せるようにやってたけど出来なかったもの・・・(つらい)
import sys
import curses
import curses.ascii
def main():
# ライブラリを初期化し、スクリーンを表すWindowObjectを返す
win = curses.initscr()
# キー入力を自動的に画面に表示しない
curses.noecho()
# Enterキーを押さずに、キー入力に直ちに反応する