lmao
This commit is contained in:
parent
224c80c420
commit
1cd19687be
21 changed files with 315 additions and 68 deletions
19
other/scripts/desktop/window-screenshot.nu
Normal file
19
other/scripts/desktop/window-screenshot.nu
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def main [ ] {
|
||||
let reg = (
|
||||
xwininfo -id (xdotool getactivewindow)
|
||||
| lines
|
||||
| parse '{key}: {value}'
|
||||
| str trim
|
||||
| get value
|
||||
| echo {
|
||||
x: $in.1
|
||||
y: $in.2
|
||||
w: $in.5
|
||||
h: $in.6
|
||||
}
|
||||
);
|
||||
|
||||
flameshot gui --region $"($reg.w)x($reg.h)+($reg.x)+($reg.y)" -c -p ~/Pictures/screenshots
|
||||
}
|
19
other/scripts/dispatcher.nu
Executable file
19
other/scripts/dispatcher.nu
Executable file
|
@ -0,0 +1,19 @@
|
|||
def main [
|
||||
interface: string
|
||||
type: string
|
||||
] {
|
||||
$env.PATH = ($env.PATH | split row (char esep) | append '/run/current-system/sw/bin');
|
||||
|
||||
let currentnet = (
|
||||
nmcli -m tabular connection show --active
|
||||
| detect columns
|
||||
| first
|
||||
| get name
|
||||
);
|
||||
|
||||
systemd-cat echo $"($currentnet) \(($interface)): ($type)";
|
||||
|
||||
if $interface == 'wlp2s0' {
|
||||
^$"/etc/networkhooks/($currentnet).nu" $interface $type
|
||||
}
|
||||
}
|
40
other/scripts/networkhooks/WIFI@DB.nu
Executable file
40
other/scripts/networkhooks/WIFI@DB.nu
Executable file
|
@ -0,0 +1,40 @@
|
|||
def main [
|
||||
interface: string
|
||||
type: string
|
||||
] {
|
||||
if not ($type == 'up') {
|
||||
exit
|
||||
};
|
||||
|
||||
mullvad disconnect;
|
||||
let page = http get 'http://172.0.0.1/';
|
||||
|
||||
let hotspot_ip = $page | htmlq 'input[name=uamip]' -a 'value';
|
||||
let hotspot_port = $page | htmlq 'input[name=uamport]' -a 'value';
|
||||
|
||||
let pl_data = $page
|
||||
| htmlq input -a name -r input[name=button]
|
||||
| lines
|
||||
| wrap name
|
||||
| merge (
|
||||
$page
|
||||
| htmlq input -a value
|
||||
| lines
|
||||
| wrap value
|
||||
)
|
||||
| drop 1;
|
||||
|
||||
let payload = $pl_data
|
||||
| each {|kv| [
|
||||
($kv.name | url encode --all)
|
||||
($kv.value | url encode --all) ]
|
||||
| str join '='
|
||||
} | str join '&';
|
||||
|
||||
let res = curl --insecure --resolve $"www.hotsplots.de:($hotspot_port):($hotspot_ip)" -H 'Content-Type: application/x-www-form-urlencoded' "https://www.hotsplots.de/auth/login.php" --data-raw $"($payload)" ;
|
||||
|
||||
let url = $res | htmlq 'meta[http-equiv=refresh]' -a 'content' | parse '0;url={url}';
|
||||
|
||||
http get $url.url.0;
|
||||
mullvad connect;
|
||||
}
|
22
other/scripts/networkhooks/WIFIonICE.nu
Normal file
22
other/scripts/networkhooks/WIFIonICE.nu
Normal file
|
@ -0,0 +1,22 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl htmlq
|
||||
|
||||
# echo "Fetching cookie and CSRF token..."
|
||||
# form=$(curl --silent --location --junk-session-cookies --cookie-jar /tmp/wifionice "https://login.wifionice.de/en/" --resolve login.wifionice.de:443:10.101.64.10 -i | htmlq "input")
|
||||
|
||||
# keys=$(htmlq "input" --attribute "name" <<< "$form")
|
||||
# values=$(htmlq "input" --attribute "value" <<< "$form")
|
||||
# payload=$(paste --delimiters="=" <(echo "$keys") <(echo "$values") | tr "\n" "&")
|
||||
|
||||
# echo "Payload: \"$payload\""
|
||||
# echo "POSTing payload..."
|
||||
|
||||
# curl --cookie /tmp/wifionice "https://login.wifionice.de/en/" --resolve login.wifionice.de:443:10.101.64.10 -d "$payload"
|
||||
|
||||
def main [
|
||||
interface: string
|
||||
type: string
|
||||
] {
|
||||
let form = curl --silent --location --junk-session-cookies --cookie-jar /tmp/wifionice 'https://login.wifionice.de/en/' --resolve 'login.wifionice.de:443:10.101.64.10' -i | htmlq 'input';
|
||||
# TODO
|
||||
}
|
41
other/scripts/networkhooks/ccchh.nu
Normal file
41
other/scripts/networkhooks/ccchh.nu
Normal file
|
@ -0,0 +1,41 @@
|
|||
const wave_timeout = 15min;
|
||||
|
||||
def main [
|
||||
interface: string
|
||||
type: string
|
||||
] {
|
||||
if not ('/var/lib/ccchh-winken/last' | path exists) {
|
||||
mkdir '/var/lib/ccchh-winken';
|
||||
0 | into datetime | save '/var/lib/ccchh-winken/last' -f;
|
||||
}
|
||||
|
||||
let $last_waved = open '/var/lib/ccchh-winken/last' --raw | into datetime;
|
||||
|
||||
if ((date now) - $last_waved) > $wave_timeout {
|
||||
if $type == "up" {
|
||||
mullvad disconnect;
|
||||
curl mqtt://mqtt.z9/winkekatze/katz9/eye/set -d (rand-color);
|
||||
curl mqtt://mqtt.z9/winkekatze/Viktoria/eye/set -d (rand-color);
|
||||
curl mqtt://mqtt.z9/winkekatze/allcats -d 'wink';
|
||||
mullvad connect;
|
||||
|
||||
date now | save '/var/lib/ccchh-winken/last' -f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def rand-color [] {
|
||||
const colors = [
|
||||
"blue"
|
||||
"cyan"
|
||||
"green"
|
||||
"pink"
|
||||
"red"
|
||||
"white"
|
||||
"yellow"
|
||||
];
|
||||
|
||||
$colors | get (random integer 0..(($colors | length) - 1))
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue