Skip to content

Instantly share code, notes, and snippets.

View david-zw-liu's full-sized avatar
:octocat:
Hello from the other side.

David Liu david-zw-liu

:octocat:
Hello from the other side.
View GitHub Profile
@david-zw-liu
david-zw-liu / taiwan_districts.json
Created April 11, 2022 03:30 — forked from abc873693/taiwan_districts.json
台灣行政區郵遞區號 JSON
[
{
"districts": [
{
"zip": "100",
"name": "中正區"
},
{
"zip": "103",
"name": "大同區"
@david-zw-liu
david-zw-liu / kmp.js
Last active July 29, 2021 16:40
KMP string search algorithm
function buildNext(pattern = '') {
const next = (new Array(pattern.length + 1)).fill(0)
let i = 0;
let j = 1
while (j < pattern.length) {
if(pattern[i] === pattern[j]) {
i++
j++
next[j] = i
@david-zw-liu
david-zw-liu / eyny-autologin.js
Created July 16, 2021 10:17
tempermonkey script
// ==UserScript==
// @name Auto-Login Eyny
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Auto login for eyny site
// @author You
// @match *://*.eyny.com/*
// @require https://code.jquery.com/jquery-3.6.0.min.js
// ==/UserScript==
@david-zw-liu
david-zw-liu / tag_cloud_sort.php
Last active November 8, 2019 07:49
修改 Wordpress 標籤雲的排序(放到主題的 function.php 檔案最後面即可)
<?php
// 修改顯示標籤的個數
$tags_number = 25;
// 這邊可以修改標籤的順序,數字越大的排在越前面
$tag_order = [
'2019電商新趨勢' => 101,
'OMO' => 100,
'新零售' => 99,
@david-zw-liu
david-zw-liu / remove_old_builds.sql
Last active January 4, 2024 06:31
Keep 1000 builds per repos for DroneCI (sqlite3 version >= 3.25 required)
-- Thank @sbengo to figure out foreign_keys constraints is defaults to false in sqlite
-- Enable to delete logs by cascading delete
PRAGMA foreign_keys = ON;
WITH n_build_ids_per_repo as (
SELECT build_id
FROM (
SELECT
build_id,
build_repo_id,
@david-zw-liu
david-zw-liu / setup-docker.sh
Created August 26, 2019 15:10
Init a new machine as a docker host
#!/bin/bash
set -e
echo "Increase pid_max limit"
echo "kernel.pid_max=4194304" >> /etc/sysctl.conf
sysctl -p
echo "Create 4G SWAP"
fallocate -l 4G /swapfile
@david-zw-liu
david-zw-liu / docker-stats.rb
Last active April 15, 2019 03:34
Docker stats with image name
#!/usr/bin/env ruby
require 'open3'
class String
def truncate(max, omission: '')
length > max ? "#{self[0...max - omission.length]}#{omission}" : self
end
end
COLUMN_WIDTH = 30
//
// 建立 pattern 的最大共同前後綴表
//
// 假設 pattern 為 ABCABA
// 建立的順序如下
// A 0
// AB 0
// ABC 0
// ABCA 1
// ABCAB 2

格助詞

什麼是格助詞?

  1. 表達單字跟動詞之間邏輯關係的詞。
  2. 格助詞因為動詞而存在。
  3. 單字的意思由格助詞決定而不是由單字決定。
  4. 語言的學習一定是正常先學,真的記不起來的才用特殊記憶法下去學。
  5. 日文當中所有的格助詞分別是: