Skip to content

Instantly share code, notes, and snippets.

Avatar

Korakot Chaovavanich korakot

  • VISTEC
  • Bangkok, Thailand
View GitHub Profile
View url.txt
https://ftx.com/#a=kora
@korakot
korakot / like.url
Created Aug 1, 2021
Shopee my favorite(like) url
View like.url
https://shopee.co.th/buyer/likes
@korakot
korakot / download.py
Created Jul 29, 2021
Use urlretrieve in Python 3
View download.py
from urllib.request import urlretrieve
urlretrieve(url, 'file.zip')
@korakot
korakot / gunzip.py
Created Jul 25, 2021
Unzip a gz file to another file
View gunzip.py
!gzip -dck in.json.gz > out.json
# d=decompress, c=stdout, k=keep
@korakot
korakot / java16.py
Created Jun 27, 2021
Install Java 16 in Colab
View java16.py
!add-apt-repository -y ppa:linuxuprising/java
!apt update
!echo oracle-java16-installer shared/accepted-oracle-license-v1-2 select true | /usr/bin/debconf-set-selections
!apt install oracle-java16-installer
# check it
!java -version
@korakot
korakot / now.rs
Created Jun 26, 2021
Run rust as a script (after cargo install cargo-script)
View now.rs
#!/usr/bin/env run-cargo-script
// cargo-deps: time="0.1.25"
extern crate time;
fn main() {
println!("{}", time::now().rfc822z());
}
@korakot
korakot / pip.py
Created Jun 6, 2021
Verbose pip install
View pip.py
!pip install -vvv git+https://github.com/tamu-helios/pyten.git
@korakot
korakot / ssd.sh
Created Mar 8, 2021
Check mac disk health (ssd)
View ssd.sh
# https://www.macworld.com/article/3609512/how-to-m1-intel-mac-ssd-health-terminal-smartmontools.html
smartctl -a disk0
@korakot
korakot / bangkok.py
Last active Mar 8, 2021
Convert UTC time to Bangkok in pandas
View bangkok.py
# from Timestamp
t.tz_localize('UTC').tz_convert('Asia/Bangkok')
# Dataframe
df['tweet_time'] = df.tweet_time.dt.tz_localize('UTC').dt.tz_convert('Asia/Bangkok')
@korakot
korakot / datetime.py
Created Mar 8, 2021
Read datetime column in pandas
View datetime.py
df = pd.read_csv('data.csv', parse_dates=['col1'])