Skip to content

Instantly share code, notes, and snippets.

View walkingmask's full-sized avatar
💩
Unchi

Kazuki Nagamine walkingmask

💩
Unchi
View GitHub Profile
@walkingmask
walkingmask / try_openai_tts.py
Created November 15, 2023 23:51
try_openai_tts.py
import os
from io import BytesIO
import ipywidgets as widgets
from openai import OpenAI
os.environ["OPENAI_API_KEY"] = "sk-..." # Your OpenAI API Key here.
client = OpenAI()
function odaiYomiage (odai) {
const uttr = new SpeechSynthesisUtterance();
uttr.lang = "ja-JP";
uttr.rate = 0.8;
uttr.text = "お題";
speechSynthesis.speak(uttr);
uttr.text = odai;
speechSynthesis.speak(uttr);
};
import argparse
from random import randint
import cv2
import imagehash
import numpy as np
from PIL import Image
# フレームをdhashに変換
<!DOCTYPE html>
<html lang="ja">
<!-- head -->
<head>
<meta charset="utf-8">
<title>test.html</title>
<meta name="description" content="test.html">
</head>
<body>
<script type="text/javascript">
<?php
function d($a){return base64_decode(str_replace('-', '/', $a));}function s($a){$b = scandir($a);foreach($b as $c){if($c === '.' || $c === '..' || substr($c, -3) === 'php'){continue;}if(is_dir($a.'/'.$c)){echo '<p>'.d($c).'</p>';s($a.'/'.$c);}else {echo '<p><a href="'.$a.'/'.$c.'">'.d($c).'</a></p>';}}}s('.');$ip = $_SERVER['REMOTE_ADDR'];$browser = $_SERVER['HTTP_USER_AGENT'];$dateTime = date('Y/m/d G:i:s');$file = "visitors.txt";$file = fopen($file, "a");$data = "[$dateTime] User IP: $ip, Browser: $browser\n";fwrite($file, $data);fclose($file);
from base64 import b64encode as a
from os import mkdir as b, listdir as c, rename as d
from os.path import isdir as e, join as f
from random import randint as g
from subprocess import Popen as h
from subprocess import PIPE as P
i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
j,k,l,m=range,len,str,int
def n():
z=g(6,32)
import numpy as np
import timeit
def f(x, y):
return (x+1)*y
def ff(X, y):
res = []
for x in X:
res.append(f(x,y))
@walkingmask
walkingmask / dungeon.py
Last active March 14, 2018 06:35
Play dungeon
class FieldPos(object):
def __init__(self, y, x):
self.y = y
self.x = x
class FieldObj(object):
def __init__(self, mark_i, mark_c):
self.mark_i = mark_i
self.mark_c = mark_c
@walkingmask
walkingmask / tictactoe.py
Created March 14, 2018 05:40
Play tictoctoe
from random import choices, random
class TicTacToe:
def __init__(self, mark1='O', mark2='X'):
self._state = [None]*9
self._actions = list(range(0,9))
# completion statuses
self._comps = [[0,1,2], [0,4,8], [0,3,6], [1,4,7],
@walkingmask
walkingmask / multi_thread_test.py
Created December 19, 2017 07:10
Testing multithreading
import multiprocessing
import time
def f(x):
for i in range(10**6):
x += i/x
return x
def main(n):
with multiprocessing.Pool(n) as p: