Skip to content

Instantly share code, notes, and snippets.

View theowenyoung's full-sized avatar

Owen theowenyoung

View GitHub Profile
@theowenyoung
theowenyoung / gatsby-node.js
Last active April 24, 2020 13:42
gatsby create node question
exports.sourceNodes = function () {
// I know I can't query the graphql data in `sourceNodes` lifecycle, just a example.
// My question is which lifecycle can I query the data, and create new node before createPages
// like this:
const allMarkdownRemarkResult = await graphql(`
@theowenyoung
theowenyoung / relay.js
Last active August 10, 2020 07:29
pipedream webhook relay
const normalizeHeaderCase = require("header-case-normalizer");
const defaultResponse = `This API enables relay requests to anywhere.
Usage:
https://eno9s1l2xztg49j.m.pipedream.net/ Shows help
https://eno9s1l2xztg49j.m.pipedream.net/<url> Create a request to <url>, and relay <url> response in the response.
]Source code : https://pipedream.com/@theowenyoung/http-relay-p_JZCLbG
`
function parseURL(req_url) {
@theowenyoung
theowenyoung / git.sh
Created September 28, 2020 06:27
github action commit & push
git config user.name github-actions[bot]
git config user.email ithub-actions[bot]@users.noreply.github.com
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{github.repository}}.git
git add .
git commit -m "chore: build"
git push
@theowenyoung
theowenyoung / us-stock-code-zh.json
Created December 16, 2020 05:03
美股代码对应中文
{
"SINA": "新浪",
"SOHU": "搜狐",
"NTES": "网易",
"BIDU": "百度",
"NCTY": "第九城市",
"JRJC": "金融界",
"JOBS": "前程无忧",
"UTSI": "UT斯达康",
"EDU": "新东方",
@theowenyoung
theowenyoung / redox.json
Last active June 2, 2021 10:35
redox keymap
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "redox/rev1",
"keymap": "redox_rev1_layout_mine",
"layout": "LAYOUT",
"layers": [
[
"ALL_T(KC_ESC)",
@theowenyoung
theowenyoung / file-browser-template-for-caddy.html
Last active September 13, 2021 05:14
Caddy file browser template with common player URL Scheme
<!DOCTYPE html>
<html>
<head>
<title>{{html .Name}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<style>
* { padding: 0; margin: 0; }
body {
@theowenyoung
theowenyoung / check-uncommited-git-github-actions.yml
Created January 21, 2022 08:47
Github Actions workflow file, check if there are uncommited changes
name: Github Actions check if there are uncommited changes
on:
repository_dispatch:
workflow_dispatch:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
@theowenyoung
theowenyoung / user.js
Created December 22, 2022 05:29
monkey
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant GM_getValue
// @grant GM_setValue
@theowenyoung
theowenyoung / User.js
Last active December 22, 2022 06:02
monkey test
// ==UserScript==
// @name Twitter Media Downloader
// @name:ja Twitter Media Downloader
// @name:zh-cn Twitter 媒体下载
// @name:zh-tw Twitter 媒體下載
// @description Save Video/Photo by One-Click.
// @description:ja ワンクリックで動画・画像を保存する。
// @description:zh-cn 一键保存视频/图片
// @description:zh-tw 一鍵保存視頻/圖片
// @version 1.05
@theowenyoung
theowenyoung / install_gost.sh
Last active February 14, 2023 13:12
Install Gost Service
#!/bin/sh
# must use root
if [ "$(whoami)" != "root" ]; then
echo "must use root"
exit 1
fi
REPO_NAME="ginuerzh/gost"
latest_version=2.11.5
echo start install $REPO_NAME latest v${latest_version}
cd /tmp