Skip to content

Instantly share code, notes, and snippets.

View changkun's full-sized avatar
🏠
https://changkun.de

Changkun Ou changkun

🏠
https://changkun.de
View GitHub Profile
@changkun
changkun / lldb-debugging.md
Created October 2, 2021 21:25 — forked from alanzeino/lldb-debugging.md
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@changkun
changkun / README.md
Created September 6, 2021 11:56 — forked from kwk/README.md
Forgot to sign-off commits?

No problem,

run

git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Your Name <Your.Name@example.com>'" HEAD~2..HEAD

To sign-off the last two commits.

Then force to push them to the remote repo with the -f option:

@changkun
changkun / 00-hand-gesture-recognition.gif
Created March 15, 2021 15:58 — forked from TheJLifeX/00-hand-gesture-recognition.gif
Simple Hand Gesture Recognition Code - Hand tracking - Mediapipe
00-hand-gesture-recognition.gif
@changkun
changkun / hotkey.go
Created February 27, 2021 14:18 — forked from koenbollen/hotkey.go
Commandline hotkey tool. Usage: `hotkey F12 say hello`
package main
// #cgo LDFLAGS: -framework Carbon
// #include <Carbon/Carbon.h>
// extern void Callback();
// void RunApplicationEventLoop();
// static inline OSStatus handler(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
// {
// Callback();
// return 1;
#include <iostream>
#include <fstream>
#include <windows.h>
#include <string>
#include <iomanip>
#include <sstream>
int width = 2;
int height = 2;
int32_t bitmap2x2[4] = { 0xffff0000, 0xff00ff00, 0xff0000ff, 0x00000000 };
@changkun
changkun / branch-fu.md
Created February 15, 2021 18:29 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@changkun
changkun / Compile_Go_for_Apple_Silicon_M1.md
Created December 10, 2020 20:38 — forked from Dids/Compile_Go_for_Apple_Silicon_M1.md
Compile Go for Apple Silicon (M1)

Compile Go for Apple Silicon (M1)

Follow these short instructions on how to compile Go for Apple Silicon (M1). From here on out, we may simply refer to it as the "ARM device".

This entire process should only take about 5-10 minutes, but please read through everything carefully, in order to avoid any potential issues along the way.

Note that at the time of writing this, Go was not yet officially available for Apple's ARM.

Additionally it should be noted that this guide expects you to only be working on the ARM device, and not to have Go installed (yet).

@changkun
changkun / app.yaml
Created November 23, 2020 09:30 — forked from akhenakh/app.yaml
Example of graceful shutdown with grpc healthserver * httpserver
readinessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 1
livenessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 2
imagePullPolicy: IfNotPresent
@changkun
changkun / foundation.go
Created November 20, 2020 05:31 — forked from 13k/foundation.go
Accessing Foundation Framework from Go with cgo
// How to build: "CC=clang go build"
package main
import (
"fmt"
"net/url"
"strconv"
"unsafe"
)