This file contains hidden or 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
find ./ -name "*.srt" -type f -exec bash -c 'iconv -f GBK -t UTF-8 "{}" > "{}.utf8" && mv "{}.utf8" "{}"' \; |
This file contains hidden or 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
#!/bin/bash | |
echo "內網 IP: $(ipconfig getifaddr en0)" | |
echo "外網 IP: $(curl -s ifconfig.me)" |
This file contains hidden or 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
# loadenv - 讀取環境變數並設置為全局變數 | |
# 此函數會從指定的 `.env` 文件中讀取環境變數,並處理包含等號(=)的變數值 | |
# Settings: | |
# $ add funtion to ~/.config/fish/functions/loadenv.fish | |
# Usage: | |
# $ loadenv .env | |
function loadenv | |
# 循環處理文件中每一行非空且不以 # 開頭的行 | |
for i in (cat $argv | grep -e '[^[:space:]]' | grep -v '^#') |
This file contains hidden or 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
# source: https://dev.to/kiwicopple/quick-tip-clone-a-single-folder-from-github-44h6 | |
# 1. Copy an empty repo | |
git clone --no-checkout https://github.com/bitnami/containers.git | |
# 2. Move into the empty repo | |
cd containers | |
# 3. Initialize sparse-checkout | |
git sparse-checkout init --cone |
This file contains hidden or 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
SERVICE_ACCOUNT_NAME="" | |
PROJECT_ID="" | |
gcloud config configurations create $CONFIG_NAME | |
gcloud config set account $SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com | |
# you need to go https://console.cloud.google.com/iam-admin/serviceaccounts, and generate a new key | |
gcloud auth activate-service-account $SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com --key-file=key.json |
This file contains hidden or 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
# ref. https://stackoverflow.com/a/59633371 | |
# Before using | |
# pip install oauth2client google-api-python-client google-cloud-bigquery | |
# export GOOGLE_APPLICATION_CREDENTIALS=<CREDENTIALS>.json | |
from google.cloud import bigquery | |
from google.cloud.bigquery import Dataset | |
from googleapiclient import discovery | |
from oauth2client.client import GoogleCredentials |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
#!/usr/bin/env python | |
# | |
# Hi There! | |
# | |
# You may be wondering what this giant blob of binary data here is, you might | |
# even be worried that we're up to something nefarious (good for you for being | |
# paranoid!). This is a base85 encoding of a zip file, this zip file contains | |
# an entire copy of pip (version 20.3.4). | |
# | |
# Pip is a thing that installs packages, pip itself is a package that someone |
This file contains hidden or 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 kafka import KafkaAdminClient | |
from kafka.admin.new_partitions import NewPartitions | |
client = KafkaAdminClient(bootstrap_servers='0.0.0.0:19092', | |
api_version=(0, 11, 5)) | |
rsp = client.create_partitions({ | |
'YOUR-TOPIC': NewPartitions(4) | |
}) |
This file contains hidden or 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
# 下載台北黑體 | |
!wget -O TaipeiSansTCBeta-Regular.ttf https://drive.google.com/uc?id=1eGAsTN1HBpJAkeVM57_C7ccp7hbgSz3_&export=download | |
import matplotlib as mpl | |
from matplotlib.font_manager import fontManager | |
# 修改字體設定 | |
fontManager.addfont('TaipeiSansTCBeta-Regular.ttf') | |
mpl.rc('font', family='Taipei Sans TC Beta') |
This file contains hidden or 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 url("https://fonts.googleapis.com/css?family=Changa One"); | |
@import url("https://fonts.googleapis.com/css?family=Imprima"); | |
body { | |
--yt-live-chat-background-color: rgba(0,0,0,0); | |
} | |
yt-live-chat-renderer { | |
background-color: transparent; | |
} |
NewerOlder