Skip to content

Instantly share code, notes, and snippets.

View michael-halim's full-sized avatar

Michael Halim michael-halim

View GitHub Profile
@michael-halim
michael-halim / mail.go
Created November 9, 2023 06:06
Sending Email with Gomail
mailer := gomail.NewMessage()
dialer := gomail.NewDialer(
SmtpHost,
SmtpPort,
Username,
Password,
)
mailer.SetHeader("From", "Sender Name" + "<" + "Sender Email" + ">")
mailer.SetHeader("To", "Reveiver Email")
@michael-halim
michael-halim / input.html
Created May 9, 2023 02:49
Add . Every 3 Numbers in Input Element using JQuery
# HTML
<input type="text" name="value" class="form-control" placeholder="Enter Value" required="" id="value">
# JQuery
$(function () {
$('body').on('keyup','input#value',function(){
let current_value = $(this).val().replace(/\D/g, '');
// Add a '.' after every 3 digits from the end of the input
@michael-halim
michael-halim / deploy_scraping_ubuntu.md
Created March 15, 2023 06:37
Deploy Website Scraping Python Selenium on Virtual Private Server (Ubuntu 22.10)

Version

  • Ubuntu 22.10
# Login into VPS
ssh <username>@<ip_address>

# Update All Dependencies
sudo apt update
sudo apt upgrade
@michael-halim
michael-halim / deploy_scraping_centos.md
Created March 15, 2023 06:29
Deploy Website Scraping Python Selenium on Virtual Private Server (CentOS 8)

Version

  • CentOS 8
# Login to VPS
ssh <username>@<ip_address>

# Get All Dependencies
sudo yum update
sudo yum upgrade
@michael-halim
michael-halim / deploy_django_centos.md
Created March 15, 2023 06:25
Deploy Django with PostgreSQL on Virtual Private Server (CentOS 8)
@michael-halim
michael-halim / useful_cronjob.md
Created March 15, 2023 05:03
Useful Cronjob Command

Set Cronjob Timezone

timedatectl set-timezone Asia/Bangkok

Delete Backups File Older Than X Days

find /home/backups -mtime +x_days -name "*.bak" -type f -delete

@michael-halim
michael-halim / deploy_django_ubuntu.md
Last active March 15, 2023 06:05
Deploy Django with PostgreSQL on Virtual Private Server (Ubuntu 22.10) Using Gunicorn and Nginx
@michael-halim
michael-halim / rank_metrics.py
Created October 28, 2022 13:03 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np