Skip to content

Instantly share code, notes, and snippets.

View pyxn's full-sized avatar
🎖️

Paul Yu pyxn

🎖️
  • Canada
View GitHub Profile
import csv
import requests
from bs4 import BeautifulSoup
import pandas as pd
from tqdm import tqdm
def get_description(url):
try:
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
/* AVAILABLE DATE RANGES:
TODAY | YESTERDAY | LAST_7_DAYS | THIS_WEEK_SUN_TODAY | THIS_WEEK_MON_TODAY | LAST_WEEK |
LAST_14_DAYS | LAST_30_DAYS | LAST_BUSINESS_WEEK | LAST_WEEK_SUN_SAT | THIS_MONTH
*/
function getYesterdaysDate() {
var date = new Date()
date.setDate(date.getDate() - 1)
var currentMonth = date.getMonth() + 1
var formatMonth = currentMonth < 10 ? '0' + currentMonth : currentMonth
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@pyxn
pyxn / hello_world.asm
Last active January 17, 2021 19:38
The Hello World Program on Assembly x86 run on macOS. Tested on M1 MacBook Pro running macOS BigSur 11.1.0.
; ----------------------------------------------------------------------------------------
; How to compile and run .asm files on macOS:
; ----------------------------------------------------------------------------------------
;
; 1. Download and open nasm-x.xx.xx-tar.gz from www.nasm.us
; 2. Open terminal and change directory to the opened folder
; 3. Enter the command "./configure" to run the configure script
; 4. Type in the "make" command to build nasm
; 5. Type in "sudo make install" to copy the built program to "/usr/bin/nasm"
; 6. Add this new directory to the paths file using "sudo nano /etc/paths"
import Foundation
extension String {
var isValidEmail: Bool {
let emailFormat: String = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailPredicate = NSPredicate(format: "SELF MATCHES %@", emailFormat)
return emailPredicate.evaluate(with: self)
}
}
@pyxn
pyxn / A003-LED-Array-Blink-Flow.ino
Created June 6, 2020 19:22
Arduino Uno - Makes an array of 10 LEDs blink systematically in a repeating flow motion
@pyxn
pyxn / A002-LED-Blink-2.ino
Created June 6, 2020 19:20
Arduino Uno - Makes 2 LEDs blink alternatively for 1 second
@pyxn
pyxn / A001-LED-Blink.ino
Last active June 6, 2020 19:19
Arduino Uno - Makes a single LED blink for 1 second
@pyxn
pyxn / deploy.sh
Last active May 12, 2020 19:53
Shell Script: Git Push Sequence
echo "Initialize $0 script..."
git add .
git commit -m "$1"
git push -u origin master
git log --oneline
echo "$0 successful."
echo "--------------------------------"
# --------------------------------
# Usage on MacOS

// Work-in-progress // script to install jekyll on ZSH.

Installation reference on MacOS Catalina running ZSH shell

Check Ruby and Gem Locations
which ruby
which gem