Skip to content

Instantly share code, notes, and snippets.

@whatisor
whatisor / resign-old-commits
Created July 22, 2022 13:53
Resign old commits
1. Find your good commit id : git log
2. git rebase --exec 'git commit --amend --no-edit -n -S' -i <your latest good commit id>
3. just save and quit when prompted
4. git push origin <branch name> --force
@whatisor
whatisor / decoder-h265.py
Created May 19, 2022 19:03
Decode h265 bitstream
#Dependencies: Python 3
# pip install av pillow
import av
import sys
def h265ToJpg():
inputFileName = "rawStream-1-20220519-132954.hevc"
container = av.open(inputFileName)
print("container:", container)
print("container.streams:", container.streams)
print("container.format:", container.format)
@whatisor
whatisor / windows-rdp-microphone
Created May 16, 2022 16:20
rdp enable audio capture
audiocapturemode:i:1
audiomode:i:1
@whatisor
whatisor / open-port-ubuntu
Created May 15, 2022 19:09
Open port ubuntu command line
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
@whatisor
whatisor / ubuntu-nodejs-install.sh
Created March 24, 2022 16:11
How to install nodejs in ubuntu
cd ~
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install nodejs
node -v
#you can change version in setup_16.x like setup_14.x
@whatisor
whatisor / gist:2151118a17f2be6b0f500146cf0cec93
Created February 5, 2022 03:33
Fix apt install dependencies broken
sudo apt --fix-broken install
@whatisor
whatisor / gist:d9ed79e37cf8270f7d0e3dcb4dab85a4
Created July 16, 2021 04:10
Remove Child Of constrain keep transformation
1. Ctrl + A -> Visual Transform
2. Remove/disable Child Of constrain.
Checked test: toFixed(0) x 5,057,837 ops/sec ±0.56% (66 runs sampled)
Checked test: Math.floor x 4,522,238 ops/sec ±0.84% (67 runs sampled)
Checked test: ~~ x 12,077,987 ops/sec ±0.34% (67 runs sampled)
@whatisor
whatisor / gist:e114606079e5c99752ea5678429800b6
Last active June 10, 2021 03:43
How to call Java function from jni
1. Jni:
extern "C" JNIEXPORT void JNICALL
Java_com_example_javaactivity_initApplicationNative(
JNIEnv* env, jobject obj)
{
__android_log_print(ANDROID_LOG_VERBOSE, "jni", "jni initApplicationNative");
env->GetJavaVM(&javaVM);
jclass cls = env->GetObjectClass(obj);
activityClass = (jclass) env->NewGlobalRef(cls);
activityObj = env->NewGlobalRef(obj);
@whatisor
whatisor / update-committer.sh
Created April 14, 2021 06:25
Change Committer info of all old commits
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Nguyen Xuan Huong"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"