Skip to content

Instantly share code, notes, and snippets.

@Koasing
Koasing / analysis.py
Created December 10, 2019 19:11
wave file lsb and msb histogram
import wave
FILENAME = 'Eternal Snow_이용신_Returned Fullmoon.wav'
wav = wave.open(FILENAME, mode='rb')
n_channels, sample_width, frame_rate, no_frames, _, _ = wav.getparams()
sample_bits = sample_width * 8
print(f'{FILENAME}')
@Koasing
Koasing / server_setup.sh
Last active August 11, 2019 01:03
ubuntu 1804 + nvidia driver + cuda + cudnn + docker + miniconda
# check PID
if [[ $EUID -ne 0 ]]; then
echo "Not a superuser... run with sudo."
exit 1
fi
# some magic values
SSH_PORT=42222
MACHINE_DIST="ubuntu"$(lsb_release -sr | sed -e "s/\.//g")
MACHINE_ARCH=$(uname -m)
@Koasing
Koasing / encode.bat
Created November 22, 2018 19:29
ffmpeg 2pass encoding
@ECHO OFF
REM 1280x 720 30fps = 5000k
REM 60fps = 7500k
REM 1920x1080 30fps = 8000k
REM 1920x0180 60fps = 12000k
:BEGIN
IF [%1]==[] GOTO :eof
@Koasing
Koasing / rsync.md
Last active May 30, 2018 05:23
Rsync for NAS beginner

Rsync for NAS beginner

Local backup

rsync -ahvP [-c] [-m] [-W] [-n] [--remove-source-files] [--log-file=FILE] src dest

use sudo to keep file ownership!

recommended options

@Koasing
Koasing / download.py
Created May 16, 2018 09:34
pytube download script
#!/usr/bin/env python3
import argparse
from pytube import YouTube
def download(url):
def progress_callback(stream, chunk, file_handle, bytes_remaining):
# this function is called by download process... do not call directly!
total_size = stream.filesize
downloaded_size = total_size - bytes_remaining
@Koasing
Koasing / Lubuntu_xrdp.md
Last active March 31, 2018 04:33
Setup xrdp on Lubuntu 17.10

Setup xrdp on Lubuntu 17.10

I recommend Lubuntu to use with xrdp, because Ubuntu's default GUI, Unity, does not work with xrdp. Lubuntu uses LXDE which is compatable with xrdp.

Install xrdp

@Koasing
Koasing / preferred_resolution.md
Last active October 24, 2017 07:19
Change preferred screen resolution of Lubuntu on VMware

Change preferred screen resolution of Lubuntu on VMware

Symptom

On some Display Manager events (login, screen-lock, etc) screen resolution changes to 800x600 forcefully, even though user setting is different.

LightDM's display-setup-script or .config/autostart methods does not fix this problem. These methods changes resolution after specified events by executing xrandr command, but other events (escpecially screen-lock) reset resolution to 800x600 and annoy me.

@Koasing
Koasing / DropboxCameraUploads.py
Last active December 19, 2016 22:55
Arrange Dropbox Camera Uploads
import os
import os.path as path
import re
from PIL import Image
IMAGE_EXTENSION = ['.jpg', '.jpeg', '.png', '.gif']
CAPTURE_SIZE = [(2048, 1536), (1136, 640)]
SCREEN_RATIO = [w/h if w > h else h/w for w, h in CAPTURE_SIZE]

Windows 7 SP1 Post-install process

Install KB3020369

  • April 2015 servicing stack update for Windows 7 and Windows Server 2008 R2
  • Required for rollup package installer
  • Detail
  • Download Page
@Koasing
Koasing / deresute_event_simulate.py
Last active September 22, 2016 19:32
デレステ イベントポイント シミュレーター
from datetime import datetime, timedelta
from datetime import time
from copy import deepcopy
# settings
start_date = datetime(2016, 9, 20, 15, 00, 00)
boost_date = datetime(2016, 9, 23, 15, 00, 00)
end_date = datetime(2016, 9, 26, 21, 00, 00)
now_date = deepcopy(start_date)