Skip to content

Instantly share code, notes, and snippets.

View theowenyoung's full-sized avatar

Owen theowenyoung

View GitHub Profile
@theowenyoung
theowenyoung / example.js
Last active March 11, 2023 11:44
curl to json, convert curl to json, convert curl to fetch options
const result = parseCurl(
"curl -X POST -H 'Content-Type: application/json' -d '{\"name\": \"John\"}' http://localhost:8000/tasks/2/run"
);
console.log("result", result);
assertEquals(result.method, "POST");
assertEquals(result.headers, {
"Content-Type": "application/json",
});
@theowenyoung
theowenyoung / update_stayfork.ts
Created February 19, 2023 04:55
Auto update stayfork userscript
async function uploadToStay() {
const userscriptContent = await Deno.readTextFile(
"dist/userscript/immersive-translate.user.js",
);
const STAYFORK_API_KEY = Deno.env.get("STAYFORK_API_KEY");
if (!STAYFORK_API_KEY) {
throw new Error("STAYFORK_API_KEY is not set");
}
const response = await fetch(
`https://api.shenyin.name/stay-fork/modify/${STAYFORK_API_KEY}`,
@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
@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 / 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 / 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 / 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 / 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 / us-stock-code-zh.json
Created December 16, 2020 05:03
美股代码对应中文
{
"SINA": "新浪",
"SOHU": "搜狐",
"NTES": "网易",
"BIDU": "百度",
"NCTY": "第九城市",
"JRJC": "金融界",
"JOBS": "前程无忧",
"UTSI": "UT斯达康",
"EDU": "新东方",
@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