Skip to content

Instantly share code, notes, and snippets.

View narrowizard's full-sized avatar
👀
focusing

NaRro narrowizard

👀
focusing
View GitHub Profile
go get -v github.com/stamblerre/gocode
go get -v github.com/ramya-rao-a/go-outline
go get -v golang.org/x/tools/gopls
go get -v golang.org/x/tools/cmd/goimports
go get -v github.com/acroca/go-symbols
go get -v golang.org/x/tools/cmd/guru
go get -v golang.org/x/tools/cmd/gorename
go get -v github.com/godoctor/godoctor
go get -v github.com/fatih/gomodifytags
go get -v github.com/josharian/impl
@narrowizard
narrowizard / proxy.sh
Created April 6, 2020 14:30
ssh proxy tunnel
ssh -fCPN -L 0.0.0.0:{localPort}:{targeIP}:{targetPort} root@127.0.0.1
@narrowizard
narrowizard / prettier.md
Last active February 21, 2020 09:02
prettier kubectl edit cm ${your configmap name}

scripts

script in source file

# cat -A will display a $ at the end of every line, so it'll be visually more pleasing than a regular grep.
cat -A < configmap.yaml | grep ' \$$'

# cat -T will show your tabs as ^I.
cat -T < configmap.yaml | fgrep '^I'

# vi: replace \t with four space
@narrowizard
narrowizard / index.html
Created January 10, 2020 06:42
script-block
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
/**
* FormatTime 格式化时间
* @param timestamp 时间戳,单位:秒
* @returns
* < 60s => 刚刚
* < 60 * 60s => n分钟前
* < 24 * 60 * 60s => n小时前
* => yyyy-MM-dd
*/
export function FormatTime(timestamp) {
let s = `<h1>Hello Vanilla!</h1>
<p>pppppppp</p>
<img />
<div>
We use Parcel to bundle this sandbox, you can find more info about Parcel
<a href="https://parceljs.org" target="_blank" rel="noopener noreferrer">here</a>.
</div>`;
var aa = /<\/?(\w+)[^>]*>/g;
let matches;
-- https://www.a2hosting.com/kb/developer-corner/mysql/determining-the-size-of-mysql-databases-and-tables
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
@narrowizard
narrowizard / docker-cleanup-resources.md
Created January 28, 2019 12:27 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@narrowizard
narrowizard / docker-cmd.sh
Created July 24, 2018 13:10
run an docker image with bash interaction.
docker run -it --entrypoint=/bin/bash $IMAGE -i