Skip to content

Instantly share code, notes, and snippets.

View NP-chaonay's full-sized avatar
🎆
HNY 2023 and been RICKROLL

Nuttapong Punpipat NP-chaonay

🎆
HNY 2023 and been RICKROLL
View GitHub Profile
@NP-chaonay
NP-chaonay / MusicalCompositionFeaturesClassification-Part1
Last active May 16, 2020 09:02
My 1st beginning DS/ML experiment with the music.
############################################################################
# Muscial Composition Features Classification - Part 1 #
############################################################################
###### General Notice ######
+ Author : Nuttapong Punpipat (NP-chaonay)
+ Updated On : 2020_05_16 16:03 (UTC)
+ General Updating Frequency : Weekly
+ Code Snippet Completeness : about 30%
+ Stability : <Beta
@NP-chaonay
NP-chaonay / user_oom.py
Last active April 24, 2020 16:33
My simple implementation of Out-of-memory mechanism for Linux.
#!/usr/bin/python3
import glob,os,time,sys
import pandas as pd
# Program parameters
CHECKING_DELAY_TIME=20
LOW_MEM_ENSURE_DELAY_TIME=10
SIGTERM_DELAY_TIME=20
SYS_UNDERLOADING_DELAY_TIME=10
LOW_MEM_THRESHOLD_KIB=100000
@NP-chaonay
NP-chaonay / pymusicnote.py
Last active September 8, 2020 14:47
(~66% completed) Musical Notation implementation on Pythons as standalone module.
### [NOTICE:CODE_MOVING] This module will be merged into package "np_chaonay".
# This Gist will be deleted after 1 month of "np_chaonay.pymusicnote" release,
# AND after 1 years of this annoucement's publishing.
# However, this Gist is continue receiving updates, then it will be stopped
# after "np_chaonay.pymusicnote" is released.
"""
Musical Notation implementation on Pythons.
Constant :
@NP-chaonay
NP-chaonay / ThaiLotteryChecker.py
Last active June 9, 2020 14:24
Thailand government lottery's prize result retriever in Python.
#!/usr/bin/env python3
# Name : Thailand Government Lottery's Prize Checker Program
# Description : Checking Thailand government lottery's prize by the processing of host server and get the data for processing using this program.
# Author : Nuttapong Punpipat (NP-chaonay)
# License : MIT License
# Language : Thai
# Version / Last Programmed : V.1.0 12/03/20 16:30 (UTC)
import http.client,sys
try:
@NP-chaonay
NP-chaonay / specialized_timer_1.py
Last active May 13, 2020 09:04
Specialized-purpose timer #1 : It can adjust "from-to duration" and when exit the program, returns the recent-counting and accumulated time.
#!/usr/bin/python3
import time
start=time.time()
end=time.time()
latency=end-start
import signal,subprocess,sys,threading,os,random
def is_str_is_integer(string):
if string[0]=='-':
n=1
else: n=0
@NP-chaonay
NP-chaonay / specialized-mplayer-audio-player-1.py
Last active May 7, 2020 08:22
My specialized music player (MPlayer front-end)
#!/usr/bin/env python3
import os,glob,random,subprocess,signal,threading,time,sys,curses
IsProcessRunning=True
Is_cli_win_display_Active=False
Has_cli_win_display_Active=False
play_no=0
args=['<Not playing>','<Not playing>']
os.chdir('/home/np-chaonay/')
songs=[]
def curses_print(msg,scr):
@NP-chaonay
NP-chaonay / UbuntuReleasesChangelogs_DataImporting.py
Last active May 11, 2020 12:23
Data Importing on Ubuntu releases' changelogs using pandas
### Program/Data Initialization ###
import urllib.request
import pandas as pd
import itertools
def pandas_series_full_display(series):
print('-'*64)
for property_i in range(series.count()):
print(str(series.index[property_i])+': '+str(series[property_i]))
@NP-chaonay
NP-chaonay / GitHub_Gist-Registration.txt
Last active December 11, 2022 09:30
(Special-typed Gist) Registration of all my gists (except those one tagged "Special" like this gist)
# (General Properties's Description)
# - Type : Available as {Program,Script,Snippet,Module,Project,Library,Docs}
# (WARNING) Script and Program Difference: Script is like a Program it is scripting AND it (recommended OR must) be confingured inside the script first.
# - Implemented_Language : If more than 1 coding language is used, specify as Multi or specify them
# (Python-related Properties's Description)
# - PythonInteractive_CopyPaste_Guaranteed :
# (Note) For shorten the sentence, define this sentence "executed by copy the whole portion and paste to Python Interactive Console" as the word "that action"
# If, all code-contained sections are able to be done that action
# Or if,
# there're at least 1 code-contained sections that are able to be done that action
@NP-chaonay
NP-chaonay / np_chaonay_main.py
Last active June 10, 2020 13:54
My module that contains general object for using.
# Name : NP-chaonay main module
# Description : My module that contains general object for using.
# Author : Nuttapong Punpipat (NP-chaonay)
# License : MIT License
# Language : English
# Version / Last Programmed : V.1.0 09/06/20 14:33 (UTC)
### TODO ###
# - Update this script : Added print_err
# - Improve print_err
# - Improve another object
@NP-chaonay
NP-chaonay / DSPAudio-Python-Snippet
Last active May 24, 2020 04:46
My DSP (Audio) code snippet
### Create sine wave and write to disk ###
import math
import numpy as np
import scipy.io.wavfile as scp_io_wav
rate=44100
freq=440
sample_num=rate*5
# Note: round to 15 due to inaccurate of resulted value when input values "pi" and "2pi"
# Note: Using modulus (When at least 1 cycle of circle sine is reached, reset to 0) to prevent bigger value cause the inaccurate of resulted value. (Using lower rounding decimal point may decrease precision when inputted value goes higher.)