Skip to content

Instantly share code, notes, and snippets.

View shunia's full-sized avatar
💭
hV7?eR6#hC5-qT6+

shunia shunia

💭
hV7?eR6#hC5-qT6+
  • GEHC
  • Beijing,China
View GitHub Profile
@shunia
shunia / README.md
Last active March 13, 2024 03:00
Windows system-wide proxy settings

The script is intended to work in PowerShell and offers a convinient way to toggle on/off proxy settings across the browser and the powershell environment itself.

How to use

  • Check and get the location of your powershell profile for the current user:
    • Windows Powershell: $HOME\Documents\WindowsPowerShell
    • PowerShell 7: $HOME\Documents\PowerShell
    • If path does not exists, create it
    • refer to this MS doc for more information
  • Enable script excution policy to make the profile work:
@shunia
shunia / Send_Key_To_Background_Application.swift
Created July 9, 2021 09:39
MacOS send keystroke to background application
import Foundation
import CoreFoundation
// all keycodes: https://gist.github.com/swillits/df648e87016772c7f7e5dbed2b345066
let KeyCode_R: UInt16 = 0x0F;
let KeyCode_N: UInt16 = 0x2D;
let src = CGEventSource(stateID: CGEventSourceStateID.hidSystemState)
let kspd = CGEvent(keyboardEventSource: src, virtualKey: KeyCode_R, keyDown: true) // space-down
let kspu = CGEvent(keyboardEventSource: src, virtualKey: KeyCode_R, keyDown: false) // space-up
adb push ${folder} /sdcard/${target_folder}
@shunia
shunia / adb_push.md
Created September 27, 2019 15:41
adb push multiple files at once

Parameters

The parameters can be replaced with the value you wanted.

  • targetFolder - target folder of you device under your sdcard, or just leave empty to target the root folder(not recommended)
  • fileExt - it's possible to use extension names to filter files, png,mkv,txt,etc.

Windows

for %f in (*.fileExt) do adb push %f /sdcard/targetFolder