Skip to content

Instantly share code, notes, and snippets.

View makzan's full-sized avatar
🎯
Focusing

Thomas Seng Hin Mak makzan

🎯
Focusing
View GitHub Profile
@makzan
makzan / layout.css
Created October 29, 2023 02:45
Basic CSS Flex and Grid layout
:root {
--min-col-width: 200px;
--max-row-width: 860px;
}
/* Simple tuning for auto cols */
@media screen and (min-width: 500px) {
:root {
--min-col-width: 150px;
}
}
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
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
# 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
/* 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%
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"]
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.
"""
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:
$ git pull --rebase origin master
@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
$ 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