Skip to content

Instantly share code, notes, and snippets.

View lantica's full-sized avatar

Sariel Wong lantica

View GitHub Profile
@lantica
lantica / dev.sh
Created September 7, 2021 03:03
Get usb device description with dev path
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "bus/"* ]] && exit
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && exit
echo "/dev/$devname - $ID_SERIAL"
)
done
@lantica
lantica / geoclue2.js
Last active February 22, 2022 08:54
Get location from geoclue
(async()=>{
const dbus = require("dbus-next");
const bus = dbus.systemBus();
const obj = await bus.getProxyObject("org.freedesktop.GeoClue2", "/org/freedesktop/GeoClue2/Manager");
const iFace = obj.getInterface("org.freedesktop.GeoClue2.Manager");
const clientPath = await iFace.GetClient();
const clientObj = await bus.getProxyObject("org.freedesktop.GeoClue2", clientPath);