Skip to content

Instantly share code, notes, and snippets.

View aoirint's full-sized avatar
🐱

aoirint aoirint

🐱
View GitHub Profile
from pydub import *
import numpy as np
import time
# https://own-search-and-study.xyz/2017/11/19/numpy%E3%81%AEarray%E3%81%8B%E3%82%89pydub%E3%81%AEaudiosegment%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B/
# https://maoudamashii.jokersounds.com/archives/song_kouichi_the_milky_way.html
path = 'song_kouichi_the_milky_way.m4a'
sound = AudioSegment.from_file(path, format='m4a')
@aoirint
aoirint / yolov3_1class.cfg
Created March 20, 2020 03:49
YOLOv3 Config
[net]
# Testing
# batch=1
# subdivisions=1
# Training
batch=24
subdivisions=12
width=608
height=608
channels=3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
https://stackoverflow.com/questions/34348669/mapping-a-texture-onto-a-quad-with-opengl-4-python-and-vertex-shaders
Open a window that displays a quad with an image on it.
"""
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
@aoirint
aoirint / opengl_shader.py
Last active March 21, 2020 11:00
GLSL init snippet
vertex_shader = glCreateShader(GL_VERTEX_SHADER)
glShaderSource(vertex_shader, vertex_shader_text)
glCompileShader(vertex_shader)
if not glGetShaderiv(vertex_shader, GL_COMPILE_STATUS):
print('Vertex shader is not OK')
print(glGetShaderInfoLog(vertex_shader))
sys.exit(1)
else:
print('Vertex shader is OK')
@aoirint
aoirint / glfw_gl.py
Last active March 21, 2020 12:17
GLFW Template
from OpenGL.GL import *
import glfw
import numpy as np
glfw.init()
window = glfw.create_window(640, 480, 'My Window', None, None)
glfw.make_context_current(window)
# These parameters need to be changed according to your environment.
set shiftwidth=4
set tabstop=4
set expandtab
"set number
set cursorline
set smartindent
set laststatus=2
syntax enable
set hlsearch
# https://qiita.com/waka424/items/bc77b6e8bd4f25760e58
export BASH_SILENCE_DEPRECATION_WARNING=1
# https://qiita.com/lemtosh469/items/81919186611ac68b11c8
# default:cyan / root:red
if [ $UID -eq 0 ]; then
PS1="\[\033[31m\]\u@\h\[\033[00m\]:\[\033[01m\]\w\[\033[00m\]\\$ "
else
PS1="\[\033[36m\]\u@\h\[\033[00m\]:\[\033[01m\]\w\[\033[00m\]\\$ "
fi
@aoirint
aoirint / keep_alive_django_db.py
Created April 24, 2020 17:57
Keep alive MySQL-Django DB Conneciton
from django.db import connection
import schedule
def do_keep_alive():
print('Sending keep alive query to DB.')
with connection.cursor() as cur:
cur.execute('SELECT 0') # dummy query to keep mysql connection alive
schedule.every(30).minutes.do(do_keep_alive)