Skip to content

Instantly share code, notes, and snippets.

View dwy6626's full-sized avatar
🎯
Focusing

De-Wei (David) Ye dwy6626

🎯
Focusing
  • Houzz Inc
  • Taipei, Taiwan
  • 10:54 (UTC +08:00)
View GitHub Profile
@dwy6626
dwy6626 / gitconfig_dw.sh
Last active June 9, 2022 17:47
git config of my local repo
#!/bin/bash
git config --local core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/my_rsa"
git config --local user.name "De-Wei Ye"
git config --local user.email [email protected]
git config --local user.signingkey 44EC9F58A7B7702282DFE2E6ED3DB57BD45490F7
@dwy6626
dwy6626 / fibonacci.py
Last active December 21, 2022 12:01
Timeit!
import time
from functools import lru_cache
import numpy as np
from matplotlib import pyplot as plt
from decimal import Decimal, getcontext
getcontext().prec = 250
@dwy6626
dwy6626 / deploy.yml
Created March 14, 2021 15:00
GitHub Action for Hugo
name: Deploy GitHub Page
on:
push:
branches:
- master
jobs:
deploy:
name: deploy github page
@dwy6626
dwy6626 / output.txt
Last active September 15, 2020 13:14
ffprobe output for 111-25-1920x1080.mp4
// ffprobe -show_streams 111-25-1920x1080.mp4 -select_streams v
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.62)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable
@dwy6626
dwy6626 / judge_rgb.py
Last active April 12, 2020 08:52
check if the mean absolute difference to channel mean > threshold
def is_color(img, threshold=1):
"""
check if the mean absolute difference to channel mean > threshold
"""
if img.ndims < 3 or img.shape[0] == 1:
return False
avg = np.mean(img, axis=2, keepdims=True)
return np.mean(np.abs(img - avg)) > threshold
@dwy6626
dwy6626 / get_images.py
Last active April 11, 2020 15:01
Download and crop Google facial expression comparison dataset and write the valid data into new csv file
"""
Download and crop FEC dataset image and write the valid data into new csv file
FEC: facial expression comparison
Please also refer to the dataset website:
https://research.google/tools/datasets/google-facial-expression/
Usage:
python get_images.py faceexp-comparison-data-[train/test]-public.csv [output_csv]
@dwy6626
dwy6626 / concatenate.py
Created April 9, 2020 05:47
NumPy concatenate
A = []
B = np.array([1,2,3]) # example 1D array
for i in range(N):
A.append(B.reshape(1, -1)) # reshape to 2D
np.concatenate(A, axis=0)
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@dwy6626
dwy6626 / wercker.yml
Created September 2, 2019 15:22
hugo wercker
box: debian
build:
steps:
- install-packages:
packages: git
- script:
name: initialize git submodules
code: |
git submodule update --init --recursive
@dwy6626
dwy6626 / .gitmodules
Last active September 2, 2019 15:22
Hugo site
[submodule "themes/blackburn"]
path = themes/blackburn
url = https://github.com/yoshiharuyamashita/blackburn.git