Skip to content

Instantly share code, notes, and snippets.

View tkoki's full-sized avatar

Takashi Koki tkoki

  • Tokyo, Japan
View GitHub Profile
@tkoki
tkoki / youtube_download.py
Created March 28, 2022 23:42
pytubeでYouTube動画をダウンロードする
import pytube
link = input('Enter Youtube Video URL ')
yt = pytube.YouTube(link)
yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
print('downloaded', link)
@tkoki
tkoki / list_walk.py
Created October 24, 2021 23:38
Pythonで複数のリストの要素とインデックスを同時に取得する
lista = [1, 2, 3]
listb = ['a', 'b', 'c']
for idx, (la, lb) in enumerate(zip(lista, listb)):
print(idx, la, lb)
@tkoki
tkoki / property_check.py
Created October 18, 2021 00:52
Pythonのクラスのプロパティ名の一覧を取得する(セットされているものしか得られない)
# coding: UTF-8
class Test():
def __init__(self, name):
self.name = name
def set_id(self, x):
self.id = x
def who_are_you(self):
@tkoki
tkoki / wifi_check.py
Created August 30, 2020 03:41
Raspberry Pi OS でWi-Fiが有効かを確認する
# coding: UTF-8
import subprocess
import re
def extract_essid(line):
# ESSID:"essid" のパターンがあるかどうか
pattern = r'.*ESSID:"(.*)"'
result = re.match(pattern, line)
if result:
return (True, result.group(1))
@tkoki
tkoki / PaintCircleDemo.cpp
Last active July 6, 2020 07:10
三角関数を使わない円のペイント
# include <Siv3D.hpp>
void PaintCircle(int cx, int cy, int r, Color c) {
int x, y;
x = r;
y = 0;
while (x >= y) {
Line(cx + x, cy + y, cx + x, cy - y).draw(1, c);
//
// The Zen Programming Language(tm)
// Copyright (c) 2018-2020 kristopher tate & connectFree Corporation.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// This project may be licensed under the terms of the ConnectFree Reference
// Source License (CF-RSL). Corporate and Academic licensing terms are also
// available. Please contact <licensing@connectfree.co.jp> for details.
//
// Zen, the Zen three-circles logo and The Zen Programming Language are
@tkoki
tkoki / XcodeProjectUpdater.cs
Last active August 7, 2023 17:12
Unity 2019.3 以降でiOSプロジェクトにAPNS関連のCapabilityを追加する
using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
// Unity 2019.3 でGetUnityTargetNameがdeprecatedになってるので。
public class MyBuildPostprocessor {
[PostProcessBuild]
@tkoki
tkoki / config.fish
Created November 22, 2018 09:03
fishde~/.config/fish/config.fish
set -gx PYENV_ROOT "$HOME/.pyenv"
status --is-interactive; and . (pyenv init - | psub)
@tkoki
tkoki / mraacheck.c
Last active December 29, 2015 00:53
Edison上でmraaがちゃんとインストールされているかを確認する
/*
Edison上で
% gcc -lmraa -o mraacheck mraacheck.c
% ./mraacheck
hello mraa
Version: v0.9.0
Running on: Intel Edison
などと表示されればok.
*/
#include "mraa.h"
@tkoki
tkoki / resignipa.sh
Created November 9, 2015 09:24
既存のipaファイルを別のプロビジョニングプロファイルで署名し直す
#!/bin/bash
IPA="/path/to/original.ipa"
NEWIPA="new_filename.ipa"
PROVISION="/path/to/new.mobileprovision"
CERTIFICATE="Name of certificate: To sign with"
unzip -q "$IPA"
rm -rf Payload/*.app/_CodeSignature
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
codesign -f -s "$CERTIFICATE" Payload/*.app
zip -qr "$NEWIPA" Payload