Skip to content

Instantly share code, notes, and snippets.

View TonyLianLong's full-sized avatar
🏠
Working at home

Long(Tony) Lian TonyLianLong

🏠
Working at home
View GitHub Profile
@TonyLianLong
TonyLianLong / seed_everything.py
Created July 7, 2022 04:04 — forked from ihoromi4/seed_everything.py
pytorch - set seed everything
def seed_everything(seed: int):
import random, os
import numpy as np
import torch
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
@TonyLianLong
TonyLianLong / convert.py
Created August 19, 2020 11:03
Convert zip archive from PyTorch to an old format
import torch
import sys
assert len(sys.argv) == 3, "Arguments: source_pth dest_pth"
loaded_pth = torch.load(sys.argv[1], map_location="cpu")
torch.save(loaded_pth, sys.argv[2], _use_new_zipfile_serialization=False)
@TonyLianLong
TonyLianLong / gist:f62820c967961d469cb54f5082da3c57
Created October 11, 2019 22:53
Convert pdf to png and to pdf
convert -density 300 input_pdf.pdf a.png; convert a*.png a.pdf
@TonyLianLong
TonyLianLong / Me.jpg
Last active June 5, 2019 06:33
Me (middle) speaking at DockerCon 19
Me.jpg
@TonyLianLong
TonyLianLong / About Me.md
Last active January 24, 2021 10:37
About Me

🌟 Nice to meet you here! I: 🌟 Started learning programming since primary school 🌟 Love working on projects with social impact 🌟 Interested in Deep Learning and Full Stack development 🌟 Also interested in Cognitive Science and Data Science

@TonyLianLong
TonyLianLong / gist:0849f01f9c57794855ef97f5bb4ec550
Created April 9, 2018 08:10
Enable modules to use prerender.io
a2enmod headers
a2enmod rewrite
a2enmod proxy_http
service apache2 restart
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get remove php7.0 -y
apt-get install php7.2 php7.2-mbstring php7.2-dom php7.2-mysql php7.2-curl -y
a2dismod php7.0
a2enmod php7.2
service apache2 restart
@TonyLianLong
TonyLianLong / database.php
Created January 2, 2018 14:40
Database config for azure InApp mysql
<?php
$connectstr_dbhost = '';
$connectstr_dbport = '';
$connectstr_dbname = '';
$connectstr_dbusername = '';
$connectstr_dbpassword = '';
foreach ($_SERVER as $key => $value) {
if (strpos($key, "MYSQLCONNSTR_localdb") !== 0) {