View download_macao_daily_front_image.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
View like_price_bot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
View macao_carpark.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the following targets for your needs | |
targets=["栢佳", "栢湖"] | |
import untangle | |
import requests | |
url = "https://dsat.apigateway.data.gov.mo/car_park_maintance" |
View rainbow-indicator.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}。" |
View bold_text_docx.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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: |
View Example of git pull with rebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git pull --rebase origin master |
View Example of git status with two changes files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
View Command to merge branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout feature_a | |
$ git merge master |
NewerOlder