Skip to content

Instantly share code, notes, and snippets.

View whexy's full-sized avatar

Wenxuan Shi whexy

View GitHub Profile
@whexy
whexy / modifyPhotoId.swift
Last active August 13, 2023 21:08
Read Apple Maker Note Asset Identifier from a HEIC file and a MOV file (live photo)
import Foundation
import ImageIO
func modifyAndSaveHEICPhoto(atPath path: String, assetIdentifier: String) {
let imageSource = CGImageSourceCreateWithURL(URL(fileURLWithPath: path) as CFURL, nil)
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource!, 0, nil) as? [CFString: Any]
var modifiedProperties = imageProperties!
var appleMakerDict = modifiedProperties[kCGImagePropertyMakerAppleDictionary] as? [CFString: Any]
appleMakerDict?["17" as CFString] = assetIdentifier
modifiedProperties[kCGImagePropertyMakerAppleDictionary] = appleMakerDict
@whexy
whexy / main.rs
Created December 25, 2022 07:36
tauri wrap of website
use tao::menu::{MenuId, MenuItem, MenuItemAttributes};
use wry::{
application::{
event::{Event, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop},
menu::MenuBar,
window::WindowBuilder,
},
webview,
@whexy
whexy / snapshot.py
Created February 18, 2022 09:24
Get snapshot of webpage use selenium and headless chrome
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
# Chrome Service with driver
CHROMEDRIVER_PATH = '/usr/bin/chromedriver'
service = Service(CHROMEDRIVER_PATH)
# Chrome Options with headless
options = Options()
@whexy
whexy / fancy_kernel_mlist.js
Created October 16, 2021 06:01
Fancy Maillist
// ==UserScript==
// @name Fancy Maillist
// @namespace http://shiwx.org/
// @version 0.1
// @description make linux maillist easy-to-read.
// @author SHI Wenxuan
// @match https://lore.kernel.org/*
// @resource tailwindCSS https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @icon https://www.google.com/s2/favicons?domain=kernel.org
@whexy
whexy / sync_juno_env.sh
Created September 26, 2021 01:26
Steps to use the sync script in Ubuntu 16.04
# use mirror
apt update
apt install git python3 python3-apt
# arm reference platform dependencies
apt install acpica-tools autoconf bc bison bridge-utils build-essential curl device-tree-compiler expect flex g++-multilib gcc-multilib genext2fs gperf libc6 libssl-dev libstdc++6 libncurses5 libxml2 libxml2-dev libxml2-utils libxml-libxml-perl make openssh-server openssh-client uuid-dev automake android-tools-adb android-tools-fastboot cython kernelshark libfreetype6-dev libpng-dev libtool net-tools nmap openjdk-8-jdk pkg-config python-dev python-mako python-nose python-numpy screen sshpass trace-cmd tree autoconf doxygen fuseext2 locales mtools wget zip zlib1g zlib1g-dev
# python
pip install PyCryptodome
apt install python3-pyelftools
pip2 install IPython bart-py devlib jupyter pandas pexpect psutil pyserial trappy
# git