Skip to content

Instantly share code, notes, and snippets.

View jdomzhang's full-sized avatar

Steven Zhang jdomzhang

View GitHub Profile
@jdomzhang
jdomzhang / zig_debugging_in_vscode.md
Last active August 28, 2022 08:28 — forked from floooh/zig_test_debugging_vscode.md
How to debug Zig in VSCode

Tested on macOS:

  1. Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
  2. Set the program field with the build output, in this example it's hello. Full launch.json looks like:
{
 "version": "0.2.0",
@jdomzhang
jdomzhang / main.go
Created July 22, 2022 07:36 — forked from yingray/main.go
Golang: aes-256-cbc examples (with iv, blockSize)
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"fmt"
)
@jdomzhang
jdomzhang / k8s-install.md
Created July 10, 2022 07:09 — forked from islishude/k8s-install.md
k8s-国内源安装

MOVE TO HERE

注意以下命令,需要切换到 root 后运行

安装 docker

首先确定已经安装完成 docker,如果没有安装可以使用以下脚本快速安装并配置:

@jdomzhang
jdomzhang / tls_test.go
Created November 15, 2019 08:50
golang tls connection with TLS 1.2
package onboarding_test
import (
"crypto/tls"
"log"
"net"
"net/http"
"testing"
)

Keybase proof

I hereby claim:

  • I am jdomzhang on github.
  • I am jdomzhang (https://keybase.io/jdomzhang) on keybase.
  • I have a public key ASACmRQE5MUoDXe3EjjtvFwJO-TzhgzUz6cqsCShfPa6iwo

To claim this, I am signing this object:

@jdomzhang
jdomzhang / go_port_forwarding.go
Created October 7, 2019 06:24 — forked from qhwa/go_port_forwarding.go
network port forwarding in go lang
package main
import (
"fmt"
"io"
"net"
)
func main() {
ln, err := net.Listen("tcp", ":8080")
function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Jakob Bindslet (jakob@bindslet.dk)
param ($targets = ".")
$hklm = 2147483650
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$regValue = "DigitalProductId4"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
@jdomzhang
jdomzhang / rename.js
Last active February 26, 2019 08:26 — forked from scriptex/rename.js
Rename all files in a folder with NodeJS
const fs = require('fs');
const path = require('path');
const args = process.argv.slice(2);
const dir = args[0];
const match = RegExp(args[1], 'g');
const replace = args[2];
const files = fs.readdirSync(dir);
files
.filter(file => {
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Swagger": {
"scope": "go",
{
"vue": {
"prefix": "vue",
"body": [
"<template>",
"",
"</template>",
"",
"<style lang='scss' scoped>",
"",