Skip to content

Instantly share code, notes, and snippets.

View openhoangnc's full-sized avatar
🌊
coding for living

Nguyen Cong Hoang openhoangnc

🌊
coding for living
  • Vietnam
View GitHub Profile
@openhoangnc
openhoangnc / Dock add app.sh
Created December 12, 2023 03:06 — forked from andrewpetrochenkov/mac-dock.sh
macOS Dock scripts
#!/usr/bin/env bash
path=/Applications/Automator.app
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$path</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock
@openhoangnc
openhoangnc / install-zig.sh
Created August 25, 2023 05:03
Install ziglang
release=$(curl -s https://api.github.com/repos/ziglang/zig/releases/latest)
tagName=$(echo $release | grep -o '"tag_name": "[^"]*' | grep -o '[^"]*$')
echo "Latest release is $tagName"
arch=$(uname -m)
if [ "$arch" == "arm64" ]
then
arch="aarch64"
fi
@openhoangnc
openhoangnc / mi12t-safe-to-remove-packages.txt
Created July 26, 2023 05:50
Bloatware packages on Xiaomi 12T
com.android.bluetoothmidiservice
com.facebook.appmanager
com.facebook.services
com.facebook.system
com.google.android.adservices.api
com.google.android.apps.safetyhub
com.google.android.apps.wellbeing
com.google.android.apps.youtube.music
com.google.android.feedback
com.google.android.play.games
@openhoangnc
openhoangnc / $$.txt
Last active April 23, 2023 10:07
FluidNC config for Sculpfun S30 pro max
$0=10
$1=25
$2=0
$3=4
$4=0
$5=1
$6=0
$10=1
$11=0.010
$12=0.002
@openhoangnc
openhoangnc / ttl65.plist
Last active August 9, 2023 17:42
TTL65 - This file will automatically set the Time To Live (TTL) or maximum hop count of the network to 65 upon startup.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ttl65</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sysctl</string>
<string>-w</string>
#!/bin/bash
#ref: https://gist.github.com/mcxiaoke/ade05718f590bcd574b807c4706a00b1
adb shell pm disable-user com.miui.powerkeeper
adb shell pm disable-user com.xiaomi.metoknlp
adb shell pm disable-user com.miui.tsmclient
adb shell pm disable-user com.miui.accessibility
adb shell pm disable-user com.miui.backup
adb shell pm disable-user com.miui.freeform
@openhoangnc
openhoangnc / install-fish-shell-debian-11.sh
Last active November 29, 2023 06:54
Install Fish Shell debian 11
#Ref https://software.opensuse.org/download.html?project=shells%3Afish%3Arelease%3A3&package=fish
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_11/ /' | sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_11/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null
sudo apt update
sudo apt install fish -y
sudo chsh -s /usr/bin/fish
@openhoangnc
openhoangnc / install-aws-cli.sh
Created January 16, 2023 03:14
Install AWS cli on macOS
curl -L https://awscli.amazonaws.com/AWSCLIV2.pkg -o /tmp/AWSCLIV2.pkg
sudo installer -store -pkg "/tmp/AWSCLIV2.pkg" -target /
rm -f "/tmp/AWSCLIV2.pkg"
@openhoangnc
openhoangnc / update-agh-arm64.sh
Last active January 10, 2023 05:14
Update AdGuardHome Linux Arm64
curl -L -S -o '/tmp/AdGuardHome_linux.tar.gz' -s 'https://static.adguard.com/adguardhome/release/AdGuardHome_linux_arm64.tar.gz'
tar -C /tmp/ -f /tmp/AdGuardHome_linux.tar.gz -x -v -z
mkdir -p ~/my-agh-backup
cd /opt/AdGuardHome
sudo ./AdGuardHome -s stop
sudo cp -r ./AdGuardHome.yaml ./data ~/my-agh-backup/
sudo cp /tmp/AdGuardHome/AdGuardHome /opt/AdGuardHome/AdGuardHome
sudo ./AdGuardHome -s start
rm -rf /tmp/*
@openhoangnc
openhoangnc / translatekeycodes.swift
Created December 9, 2022 10:44 — forked from vayn/translatekeycodes.swift
virtual key codes to unicode characters
func keyCodeToString(keyCode: CGKeyCode) -> String {
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData)
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr)
var deadKeyState: UInt32 = 0
var actualStringLength = 0
var unicodeString = [UniChar](count: 255, repeatedValue: 0)
let status = UCKeyTranslate(keyboardLayoutPtr,