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 / 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 => {
@jdomzhang
jdomzhang / set gopath on mac
Created April 11, 2018 13:01 — forked from molivier/gist:271bba5d67de1583a8e3
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=/Users/username/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
UPSTART
sudo vi /etc/init/<reponame>.conf
add inside:
description "<reponame>"
author "name"
env PROGRAM_NAME="<reponame>"