execute: sudo purge
may help with ram issue?
MacOS
2023-02-18
2022-12-10
when installing global ackages, we do not need to specify NODE_PATH. but it is not configured beforehand thus when you want to import packages from there you will face issue.
for zsh/bash/fish:
1 | export NODE_PATH=<NODE_PATH> |
on windows just use the old school drill (open environment editor)
chech the exact path of NODE_PATH
after invoking npm install -g <package_name>
, then check if the installed package exists in that path you guessed.
on termux: /data/data/com.termux/files/usr/lib/node_modules
on kali: /usr/local/lib/node_modules
(may be inaccurate)
on macos: /opt/homebrew/lib/node_modules
(nodejs installed via brew)
2022-10-15
to change the resolution of android device run this command:
1 | # <width>x<height> |
launch scrcpy with HID simulation and screen off:
1 | scrcpy -SK |
run android in docker, run adb in docker
device discovery, termux daemon, remote unlock
unlock requires screenshot and input events.
https://technastic.com/unlock-android-phone-pin-pattern-adb/
click ok after input password:
https://stackoverflow.com/questions/29072501/how-to-unlock-android-phone-through-adb
scrcpy client
https://github.com/leng-yue/py-scrcpy-client
https://leng-yue.github.io/py-scrcpy-client/guide.html#bind-events
you want to use android emulator on macos m1?
https://github.com/google/android-emulator-m1-preview/releases/tag/0.3
check android screen lock/unlock state
https://android.stackexchange.com/questions/191086/adb-commands-to-get-screen-state-and-locked-state
Bonjour/Avahi/Zeroconf
logic: if the kill switch is off, when no physical input events happens, or not focused on scrcpy window with keyboard/mouse input events on pc for some time, allow to interact with the phone.
get physical events:
warning: this command could be offline for a short period of time after using the scrcpy. must automatically reconnect if the device is not offline.
1 | adb -s 192.168.10.3:5555 shell getevent |
to get focused window title:
hint: for headless ssh sessions, must set apropriate xorg environment variables, eg: env XAUTHORITY="/run/user/0/gdm/Xauthority" DISPLAY=:1 python3
general method:
1 | import pywinctl |
for linux:
1 | watch -n 2 xdotool getactivewindow getwindowname |
for macos: (allow permission first, deprecated since it will not get the window title instead of the program name)
https://alvinalexander.com/mac-os-x/applescript-unix-mac-osx-foreground-application-result/
(where is the window name?)
1 | sleep 3 && osascript -e 'tell application "System Events"' -e 'set frontApp to name of first application process whose frontmost is true' -e 'end tell' |
to get input events on macos:
download keylogger here:
https://hackernoon.com/writing-an-keylogger-for-macos-in-python-24adfa22722
https://github.com/beatsbears/pkl?ref=hackernoon.com
1 | python pkl_nowriting.py |
input events on linux:
1 | xinput test-xi2 --root |