Skip to content

Instantly share code, notes, and snippets.

View washanhanzi's full-sized avatar
🏊
Learning & Making

Jingyu washanhanzi

🏊
Learning & Making
View GitHub Profile
@washanhanzi
washanhanzi / README.md
Created August 19, 2024 03:50 — forked from alexanderson1993/README.md
Prisma D1 Migration CLI
migrate.mov

A handy CLI for working with the new Cloudflare D1/Prisma integration. You can read about that here: https://blog.cloudflare.com/prisma-orm-and-d1

Getting Started

  • Install wrangler, Prisma, and the other dependencies
npm install prisma@latest @prisma/client@latest @prisma/adapter-d1
@washanhanzi
washanhanzi / TauriLoader.ts
Created December 24, 2023 08:55 — forked from nathanbabcock/TauriLoader.ts
Use Tauri's HTTP package to play Hls.js livestreams
import {
type HlsConfig,
type Loader,
type LoaderCallbacks,
type LoaderConfiguration,
type LoaderContext,
type LoaderOnProgress,
type LoaderResponse,
type LoaderStats,
} from 'hls.js'
@washanhanzi
washanhanzi / actionlist.vim
Created March 15, 2023 11:44 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@washanhanzi
washanhanzi / time.js
Created December 15, 2020 10:50
javascript pain in date and time
//get localtime from browser
function getLocalTime() {
let d = new Date()
return (1e3 - ~d.getUTCMonth() * 10 + d.toUTCString() + 1e3 + d / 1)
.replace(/1(..)..*?(\d+)\D+(\d+).(\S+).*(...)/, '$3-$1-$2T$4.$5Z')
.replace(/-(\d)T/, '-0$1T')
}
//get 00:00:00 time at UTC
let now = new Date()
@washanhanzi
washanhanzi / wait-for-postgres.sh
Created November 27, 2020 09:31
sh script for docker to wait postgresql ready. use env for password and uri to test connection. command: ["/wait-for-postgres.sh", "postgresql://admin@db:5432/postgres", "/main"]
#!/bin/sh
# wait-for-postgres.sh
set -e
uri="$1"
shift
cmd="$@"
until PGPASSWORD=$POSTGRES_PASSWORD psql "$uri" -c '\q'; do
customization:
distribution_code_name: Weasel
distribution_version: 0.14.3
generator: "Rime::SwitcherSettings"
modified_time: "Fri Mar 20 03:32:41 2020"
rime_version: 1.5.3
patch:
schema_list:
- {schema: luna_pinyin}
- {schema: luna_pinyin_simp}
@washanhanzi
washanhanzi / cookbook.md
Last active June 30, 2020 02:55
Linuxt cookbook

WSL

查看本机ip

cat /etc/resolv.conf

设置apt get代理

sudo vim /etc/apt/apt.conf.d/proxy.conf
@washanhanzi
washanhanzi / Flutter_behind_wall.md
Last active May 26, 2020 02:37
防火墙内使用flutter代理配置

Windows

You can either setting gradle proxy or using mirror site. Or use both if you like.

Setting Gradle Proxy

  1. Global gradle proxy setting, user/.gradle/gradle.properties
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Change to wsl home directory
cd ~
# Path to your oh-my-zsh installation.
export ZSH="/home/frank/.oh-my-zsh"
# Set go path

Credentials

  • clear credential cache
git config --global --unset credential.helper
git config --system --unset credential.helper
  • set credential manager (windows)