Skip to content

Instantly share code, notes, and snippets.

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

Nuttapong Punpipat NP-chaonay

🎆
HNY 2025 and been RICKROLL
View GitHub Profile
@NP-chaonay
NP-chaonay / DS_Audio_CodeSnippist_1.py
Last active May 25, 2020 15:29
1st code snippist for Data Science project on Audio Processing.
#### Get the most n highest-amplitude musical note using my custom algorithm of FFT (on FFT length 35999) on each period (4134 samples) in the arr.
### Metadata
+ Author : Nuttapong Punpipat (NP-chaonay)
+ Updated On : 25/05/2020 at 9:56 UTC
+ General Updating Frequency : Weekly
+ Code Snippet Completeness : N/A
+ Stability : Beta
### General Notices
@NP-chaonay
NP-chaonay / DS_Snippist_1.py
Last active May 29, 2020 06:30
Get specific fields of n randomly-selected songs metadata, on each mode group (Major-Minor), from MillionSongDataset.
# Import objects
import numpy as np
import pandas as pd
import h5py,random
# Prepare file
path='./Misc/msd_summary_file.h5'
hd5_file=h5py.File(path,'r')
# Shuffle and get n randomly-selected songs index (on each mode group (Major-Minor))
maj_index=np.where( hd5_file['analysis']['songs']['mode']==0 )[0]
@NP-chaonay
NP-chaonay / Stopwatch.py
Last active June 23, 2020 12:19
My main stopwatch program written in Python.
#!/usr/bin/env python3
# Name: Main Stopwatch
# Description: My main stopwatch program written in Python.
# Author: Nuttapong Punpipat (NP-chaonay)
# Version: V.2.0.0_beta
# Revised Date: 2020-06-23 12:20 (UTC)
# License: MIT License
# Version Note:
# - Major version: indicates of very significant changes or changes that break compatibility on some system/platforms.
# - Minor version: indicates of significant changes or features adding.
@NP-chaonay
NP-chaonay / remove_last_char.py
Last active July 5, 2020 15:31
Remove last charecter from text-encoded file (UTF-8 is supported).
#!/usr/bin/env python3
from types import SimpleNamespace as Namespace
import sys
# Future function from np_chaonay.main
def tmp(err,status_msg=None,IsWarning=False):
name=type(err).__name__
if not IsWarning:
type_='Error'
if status_msg==None: status_msg='Program operation has error due to Python exception.'
@NP-chaonay
NP-chaonay / MusicKeyModeClassifcation-1.py
Last active September 29, 2020 10:58
Own created algorithm for classify key and mode of the music.
import pandas as pd
import numpy as np
## Function "pitch_letter_encoder" from future module "np_chaonay.pymusicnote"
def pitch_letter_encoder(pitch_letter):
"""Encode pitch letter to 0-11
Arguments:
- pitch_letter (str-alike): pitch letter
"""
@NP-chaonay
NP-chaonay / Todo_Academic_Record_V0.py
Last active October 7, 2020 15:05
Python script for viewing/manipulating to-do list, designed for academic usage.
#!/usr/bin/env python3
# Name: Academic Todo Recording
# Description: Program helps you deal with entries of academic todo record.
# Author: NP-chaonay (Nuttapong Punpipat)
# Version: 0.0.0_alpha
# Version Note:
# - Major version: File produced on different major version is not compatible
# - Minor version: Features adding
# - Micro version: Bugs fixing
# Revised Date: 2020-08-09 15:13 (UTC)
@NP-chaonay
NP-chaonay / GradientDescentAlgo_1.py
Last active July 28, 2020 03:27
My edited version of gradient descent algorithm (See more description below)
#!/usr/bin/env python3
# Name: My edited version of gradient descent algorithm No.1
# Description: My edited version of gradient descent algorithm.
# In this sample code, we use gradient descent for determining value of x in ax^3+bx^2+cx+d that nearly matches to truth value using given a,b,c,d values (x is weight; a,b,c,d are inputted data)
# Author: NP-chaonay (Nuttapong Punpipat)
# Version: Unversioned
# Version Note: None
# Revised Date: 2020-07-27 05:34 (UTC)
# License: MIT License
# Programming Language: Python
@NP-chaonay
NP-chaonay / MentimeterWordcloudQuestionScraping.py
Last active July 27, 2020 06:33
Mentimeter Wordcloud Question Scraping
# Mentimeter Wordcloud Question Scraping
import http.client,json
import pandas as pd
question_id='000000000000'
HTTP_C=http.client.HTTPSConnection('api.mentimeter.com')
HTTP_C.request('GET','/questions/'+question_id+'/result?isPublic=true')
HTTP_R=HTTP_C.getresponse()
@NP-chaonay
NP-chaonay / RandomQuizes.py
Last active August 12, 2020 05:26
Scripts for random quizes.
#!/usr/bin/env python3
# Name: RandomQuizes
# Description: Scripts for random quizes.
# Author: NP-chaonay (Nuttapong Punpipat)
# Version: Unversioned
# Version Note: N/A
# Revised Date: 2020-08-09 07:27 (UTC)
# License: MIT License
# Programming Language: Python
# CUI/GUI Language: English
@NP-chaonay
NP-chaonay / Academic_PythonInit.py
Last active September 10, 2020 13:51
Python Initialization for Academic Usage
#!/usr/bin/env python3
# Name: Python Initialization for Academic Usage
# Description: Python Initialization for Academic Usage
# Author: NP-chaonay (Nuttapong Punpipat)
# Version: Unversioned
# Version Note: N/A
# Revised Date: 2020-09-10 13:51 (UTC)
# License: MIT License
# Programming Language: Python
# CUI/GUI Language: English