Skip to content

Instantly share code, notes, and snippets.

View syneart's full-sized avatar

Jed Hong syneart

  • SentraSmart Inc.
  • Taipei, Taiwan
View GitHub Profile
@syneart
syneart / meld_hotfix_sonoma.sh
Last active November 15, 2024 15:08
Meld v3.21.0 (r4) hot-fix for macOS on Intel CPU / Apple Silicon CPU with Rosetta
### Test on https://github.com/yousseb/meld/releases/tag/osx-20
### OSX - 3.21.0 (r4) Sonoma
### !!! Note: You need put the Meld.app r4 build to the /Applications path first.
#!/bin/zsh
#Fix libpng16.16.dylib not found
install_name_tool -change /usr/local/opt/libpng/lib/libpng16.16.dylib @executable_path/../Frameworks/libpng16.16.dylib /Applications/Meld.app/Contents/Frameworks/libfreetype.6.20.0.dylib
#Fix libbrotlidec.1.dylib not found
@syneart
syneart / Backup_each_db.bat
Last active May 4, 2023 06:38
Backup mysql databases into split sql file
@echo off&cls
SET z="C:\Program Files\7-Zip\7z.exe"
SET MYSQL_BIN_PATH="[REPLACE HERE BY YOURSELF, FOR EXAMPLE: C:\mysql\bin]"
SET LOCAL_STORE_BASE_PATH="[REPLACE HERE BY YOURSELF, FOR EXAMPLE: C:\]"
SET DATABASE_USERNAME="[REPLACE HERE BY YOURSELF, FOR EXAMPLE: root]"
SET DATABASE_PASSWORD="[REPLACE HERE BY YOURSELF, FOR EXAMPLE: password]"
SET TodayYear=%date:~0,4%
SET TodayMonthP0=%date:~5,2%
SET TodayDayP0=%date:~8,2%
@syneart
syneart / vim_zh_tw_and_color.sh
Created March 18, 2021 17:00
讓 vim 支援顯示中文和顯示顏色
#!/bin/bash
cat > ~/.vimrc <<EOF
syntax on
set fileencodings=utf-8
set termencoding=utf-8
set encoding=utf-8
EOF
@syneart
syneart / debian_locale_zh_tw.sh
Last active October 12, 2024 15:23
Debian 輸入與顯示正體中文字
#!/bin/bash
export LC_ALL="en_US.UTF-8"
sudo sed -i '/^#.* zh_TW.* /s/^#//' /etc/locale.gen
sudo locale-gen
sudo update-locale LANG="zh_TW.UTF-8" LANGUAGE="zh_TW"
echo "Please re-login or restart your system!"
@syneart
syneart / deviceConnect2Wifi.sh
Created January 12, 2021 07:43
Android debugging over WiFi (use adb)
#!/bin/bash
# This shell script is made by SyneArt <[email protected]>
# Android Studio default path on Mac
adb=~/Library/Android/sdk/platform-tools/adb
function connect() {
device_id=$1
device_ip=`${adb} -s ${device_id} shell ip -f inet addr show wlan0 | grep -e "[0-9].*\/[0-9]*" | awk '{ print $2 }' | sed 's/\/[0-9]*//'`
echo "Android device id: ${device_id}"
@syneart
syneart / uhd_installer.sh
Last active June 25, 2024 22:41
Get latest USRP Hardware Driver from apt with install or upgrade
#!/bin/bash
# This shell script is made by SyneArt <[email protected]>
#######################################
# INSTALL UHD ON UBUNTU OR DEBIAN #
#######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |--------------------------------------------------------|
# | OS | UHD | Test | Last test |
# |----------------|------------------|------|-------------|
@syneart
syneart / mysql_native_password.sh
Last active May 29, 2019 11:53
Set default root password for MySQL 5.7 with Ubuntu when MySQL doesn't ask for root password at installing
#!/bin/sh
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |--------------------------------------------------------|
# | OS | MySQL | Test | Last test |
# |--------|--------------------------|------|-------------|
# | Ubuntu | Ver 14.14 Distrib 5.7.26 | OK | 16 May 2019 |
MYSQL_ROOT_PASSWORD=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c10`
sudo mysql -uroot<<EOF
use mysql;
@syneart
syneart / netgear_firmware_crawler.py
Last active March 2, 2024 02:37
To download all Netgear's firmwares
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
# pip2 install requests BeautifulSoup4 wget --user
import os, requests, json, re, wget
from bs4 import BeautifulSoup
root_save_dir_path = r'./netgear/'
if not os.path.isdir(root_save_dir_path):
os.mkdir(root_save_dir_path)
@syneart
syneart / caffeine-indicator.patch
Last active September 27, 2023 01:48
Default start caffeine in active mode (patch for caffeine-indicator 2.9.4 [https://launchpad.net/caffeine])
27a28
> import subprocess
64,68d64
< # Handle command line arguments
< parser = argparse.ArgumentParser(prog=PROGRAM_NAME, description='Toggle desktop idleness inhibition')
< parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + ' ' + VERSION)
< parser.parse_args()
<
179d174
<
@syneart
syneart / build_wireshark.sh
Last active November 11, 2024 20:39
BUILD WIRESHARK ON UBUNTU OR DEBIAN
#!/bin/sh
# This shell script is made by SyneArt <[email protected]>
#######################################
# BUILD WIRESHARK ON UBUNTU OR DEBIAN #
#######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |----------------------------------------------------------|
# | OS | Wireshark | Test | Last test |
# |--------------------|----------------|------|-------------|