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 / NewYearCountdownOnPython.py
Last active December 30, 2022 17:13
New Year Countdown But On Python
# WARNING: beware when using relative path, pls check working directory too.
# REMARK: pls see all comments, and in near actual NY event, run this script before time that "Countdown Final Alert" is occured (23:45 of NY Eve).
import subprocess as sp
import datetime,time
# Path to song
main_song_path='./Music/Edited/Events/NewYear2023/'
# Timestamp for "Countdown Final Alert" which alert before NY. 15minutes
@NP-chaonay
NP-chaonay / TCAS64_Snippets.md
Last active January 14, 2021 08:39
TCAS64 Scripts and Snippets for Python
@NP-chaonay
NP-chaonay / disk_overwriting.py
Last active December 26, 2020 14:16
Bytes Overwriting on Entire Disk, using Python
# [USER_PARAM] Path to device file
path='/dev/sda'
# [USER_PARAM] Physical Sector Size of Disk (Used only in buffer_size and information displaying, can be ignore)
physical_sector_size=4096
# [USER_PARAM] Buffer Size
buffer_size=physical_sector_size*2
# [USER_PARAM] Writing Bytes Value (Set to 0 to overwrite disk to zero, else set to 255 for overwriting to ones)
writing_bytes_value=0
# User Confirmation
@NP-chaonay
NP-chaonay / ML_DL_AI_Snippets_1.py
Created September 10, 2020 13:55
Snippet for ML/DL/AI
# Check for data entries amount of dense layer (count weight+bias+output)
def dense_layer_datanum(in_shape,dense_out,axis=-1):
in_shape=list(in_shape)
dense_in=in_shape[axis]
in_shape[axis]=dense_out
result_out=1
for i in in_shape: result_out*=i
return (dense_in+1)*dense_out+result_out
@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
@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 / 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 / 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 / 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 / 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
"""