Skip to content

Instantly share code, notes, and snippets.

View lizhang20's full-sized avatar
🌧️

Li Zhang lizhang20

🌧️
View GitHub Profile
@lizhang20
lizhang20 / client url
Created January 12, 2024 15:18
share client
https://apkcombo.com/share%E5%BE%AE%E5%8D%9A%E5%AE%A2%E6%88%B7%E7%AB%AF/com.hengye.share/
@lizhang20
lizhang20 / fix.sh
Last active December 18, 2023 03:12
fix my network error on macos
networksetup -listallhardwareports
sudo ifconfig en7 down
# release the current DHCP lease
sudo ifconfig set en7 BOOTP
# initiate a new DHCP lease process.
# the DHCP client sends a broadcast request
# to the DHCP server asking for an IP address
sudo ipconfig set en7 DHCP
sudo ifconfig en7 up
ifconfig en7
@lizhang20
lizhang20 / snowjob.sh
Created December 15, 2023 13:46 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
@lizhang20
lizhang20 / hn-copybutton.js
Last active September 17, 2023 03:59
Enhance your HN page with copy buttons (Tampermonkey scripts)
// ==UserScript==
// @name Hacker News Cliakable Copy Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Copy the title of HN articles in rich text
// @author Li Zhang
// @match https://news.ycombinator.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@lizhang20
lizhang20 / Dockerfile
Created September 11, 2023 01:52
Dockerfile for building Android compiling env
FROM ubuntu:18.04
RUN apt update && apt install -y git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev g++-multilib tofrodos libxml2-utils xsltproc vim cgpt samba libxml-simple-perl libssl-dev bc rsync python3 android-tools-fsutils fish
CMD ["bash"]
@lizhang20
lizhang20 / Vagrantfile
Created May 26, 2023 07:57
A simple vagrant template
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@lizhang20
lizhang20 / clean.py
Last active July 17, 2024 02:40
Remove unused files in a LaTex project
import os
import sys
def recursive_search_and_remove(latex_log, dir):
for f in os.listdir(dir):
if os.path.isdir(os.path.join(dir, f)):
recursive_search_and_remove(latex_log, os.path.join(dir, f))
else:
if f not in latex_log:
@lizhang20
lizhang20 / Query.java
Created April 24, 2022 02:16
MediaCodec query capabilities
/*
MIME_TYPE, Encoder Name
-----------------------
video/avc, OMX.qcom.video.encoder.avc
video/hevc, OMX.qcom.video.encoder.hevc
video/hevc, OMX.qcom.video.encoder.hevc.cq
video/vp8, video/x-vnd.on2.vp8
*/
@lizhang20
lizhang20 / deprecated.py
Created April 13, 2022 15:18
Python utils
"""
Reference: https://stackoverflow.com/questions/2536307/decorators-in-the-python-standard-lib-deprecated-specifically
"""
import warnings
import functools
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
@lizhang20
lizhang20 / Android_cpu_gpu_metrics.sh
Last active March 24, 2022 13:47
Android monitor script
echo "==================GPU======================"
echo Used / Total:
adb shell cat /sys/class/kgsl/kgsl-3d0/gpubusy
echo Utilization rate:
adb shell cat /sys/class/kgsl/kgsl-3d0/gpu_busy_percentage
echo Max frequencies:
adb shell cat /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
echo Min frequencies:
adb shell cat /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
echo Available frequencies: