Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Thomas Seng Hin Mak makzan

🎯
Focusing
View GitHub Profile
@makzan
makzan / like_price_bot.py
Created Dec 30, 2021
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 Dec 22, 2021
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 Dec 7, 2021
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 Nov 17, 2021
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 Sep 25, 2021
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 Sep 25, 2021
Command to merge branch in Git version control
View Command to merge branch
$ git checkout feature_a
$ git merge master
@makzan
makzan / Code snippet to create new branch
Created Sep 25, 2021
Code snippet to create new branch In Git Version Control