Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Thomas Seng Hin Mak makzan

🎯
Focusing
View GitHub Profile
View download_macao_daily_front_image.py
import requests
from bs4 import BeautifulSoup
from datetime import date
from urllib.request import urlretrieve
y,m,d = date.today().isoformat().split('-')
url = f"http://www.macaodaily.com/html/{y}-{m}/{d}/node_2.htm"
@makzan
makzan / like_price_bot.py
Created December 30, 2021 08:21
Telegram Like Pirce Bot
View like_price_bot.py
from telegram.ext import Updater
from telegram import Update
from telegram.ext import CallbackContext
from telegram.ext import CommandHandler
TOKEN = "YOUR_BOT_API_TOKEN_HERE"
updater = Updater(token=TOKEN)
def start(update: Update, context: CallbackContext):
@makzan
makzan / macao_carpark.py
Created December 22, 2021 16:29
Macao Carpark 澳門公共停車場剩餘量 API with Python
View macao_carpark.py
# Change the following targets for your needs
targets=["栢佳", "栢湖"]
import untangle
import requests
url = "https://dsat.apigateway.data.gov.mo/car_park_maintance"
@makzan
makzan / rainbow-indicator.css
Created December 7, 2021 19:20
Logseq Rainbow progress indicator
View rainbow-indicator.css
/* Rainbow Progress Indicator */
[data-ref^="rainbow-"]:before {
content: '';
display: inline-block;
margin-right: .5em;
width: 30px;
height: 5px;
background: linear-gradient(to right,
grey 11%,
transparent 11%
View fetch_osmosis_like_coin_widget.py
import requests
from datetime import datetime
url = "https://api.coingecko.com/api/v3/simple/price?ids=osmosis,likecoin&vs_currencies=usd"
res = requests.get(url)
data = res.json()
like_usd = data["likecoin"]["usd"]
osmo_usd = data["osmosis"]["usd"]
View fetch_osmosis_like_coin_price.py
import requests
url = "https://api.coingecko.com/api/v3/simple/price?ids=osmosis,likecoin&vs_currencies=usd"
res = requests.get(url)
data = res.json()
like_usd = data["likecoin"]["usd"]
osmo_usd = data["osmosis"]["usd"]
result = f"現時 LIKE 兌美元為 {like_usd},OSMO 兌美元為 {osmo_usd}。"
@makzan
makzan / bold_text_docx.py
Created November 17, 2021 06:50
This script open all DOCX files in the current folder and print out the bold text from paragraphs and tables.
View bold_text_docx.py
"""
This script open all DOCX files in the current folder and print out the bold text from paragraphs and tables.
"""
import docx
import glob
def print_bold_text_in_paragraphs(paragraphs):
for p in paragraphs:
for run in p.runs:
@makzan
makzan / Example of git status with two changes files
Created September 25, 2021 13:03
For use in my Git Version Control book/course
View Example of git status with two changes files
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: app/assets/javascripts/components/last-save.js.jsx
modified: app/assets/stylesheets/app.css.scss
@makzan
makzan / Command to merge branch
Created September 25, 2021 12:58
Command to merge branch in Git version control
View Command to merge branch
$ git checkout feature_a
$ git merge master