Skip to content

Instantly share code, notes, and snippets.

View zthxxx's full-sized avatar
🐾
Nyaa~

zthxxx zthxxx

🐾
Nyaa~
View GitHub Profile
import { existsSync } from 'fs'
import { inspect } from 'util'
import { Service } from '@umijs/core'
const isDev = process.env.NODE_ENV === 'development'
const umiService = new Service({
cwd: process.cwd(),
@zthxxx
zthxxx / bin.mjs
Last active July 14, 2021 16:56
hack for pass multiple arguments in shebang
#!/bin/sh
':' // ; exec node --experimental-modules --experimental-specifier-resolution=node "$0" "$@"
// hack for pass multiple arguments in shebang
// The colon(:) is shell built-in command, which means do nothing, whatever its parameters are.
// https://stackoverflow.com/questions/48179714/how-can-an-es6-module-be-run-as-a-script-in-node
import xxx from 'xxx'
@zthxxx
zthxxx / antd-split-components.js
Created January 1, 2021 11:14
antd-split-components.js
import fs from 'fs'
import path from 'path'
const libs = [
'Affix',
'Alert',
'Anchor',
'AutoComplete',
'BackTop',
# find merge-request which contains commit in GitLab
# https://gitlab.com/gitlab-org/gitlab-foss/-/issues/28037
# https://stackoverflow.com/a/17819027/7277090
git config --add remote.origin.fetch '+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*'
git fetch origin
git for-each-ref --contains <hash> | grep merge-requests | head -n 10
@zthxxx
zthxxx / colorsheet.zsh
Last active November 24, 2021 08:07
display 256 colors in terminal
# print 256-color pattern
function sheet:color {
local block row col fg_color bg_color
local i
print -P "$(
echo -n '\n'
# the 16 base colors
for i in {0..15}; do
function gen_ssl_cert {
local prefix="${1}"
openssl genrsa -des3 -out "${prefix}.lock.key" 1024
openssl rsa -in "${prefix}.lock.key" -out "${prefix}.key"
rm "${prefix}.lock.key"
openssl req -new -key "${prefix}.key" -out "${prefix}.csr"
openssl x509 -req -days 3650 -in "${prefix}.csr" -signkey "${prefix}.key" -out "${prefix}.crt"
openssl pkcs12 -export -inkey "${prefix}.key" -in "${prefix}.crt" -out "${prefix}.pfx"
@zthxxx
zthxxx / .gotty
Last active June 11, 2020 10:54
local gotty config
// https://github.com/yudai/gotty
// [string] Address to listen, all addresses will be used when empty
address = "localhost"
// [string] Port to listen
// ywwuyi 6655
port = "6655"
// [bool] Permit clients to write to the TTY
@zthxxx
zthxxx / inspectComponent.ts
Created March 26, 2020 13:25
inspect component name with hover dom
import React from 'react'
import { injectGlobal } from 'emotion'
React.__origin_createElement = React.createElement
React.createElement = ((type, props, ...children) => {
const createElement = React.__origin_createElement
if (type === null || type === undefined || typeof type === 'string') {
@zthxxx
zthxxx / kill-SymDaemon.sh
Last active December 14, 2022 07:59
stop and kill Symantec daemon on macOS
#!/usr/bin/env bash
# curl -o- https://gist.githubusercontent.com/zthxxx/607b8793885197ff61fb79a3d9db25cb/raw/kill-SymDaemon.sh | bash
launchctl unload /Library/LaunchAgents/com.symantec.uiagent.application.*plist
sudo launchctl unload /Library/LaunchDaemons/com.symantec.*.plist
sudo rm -rf /Library/LaunchAgents/com.symantec.uiagent.application.*plist /Library/LaunchDaemons/com.symantec.*.plist
ps -ef | grep -i symantec
POSTGRES_USER='xxxxx'
POSTGRES_PASSWORD='xxxxx'
docker volume create pgdata
docker run -d --rm \
-v pgdata:/var/lib/postgresql/data \
-p 127.0.0.1:5432:5432 \
-e "POSTGRES_USER=$POSTGRES_USER" \
-e "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" \