Skip to content

Instantly share code, notes, and snippets.

@h4de5
h4de5 / _toshiba-api.php
Last active October 16, 2023 19:45
Toshiba AC API Client - Get status and settings from Toshiba AC Services (used e.g. in RAS-18PKVSG-E + RAS-18PAVSG-E + WIFI Adapter RB-N103S-G)
#!/usr/local/bin/php73
<?php
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
/**
* @param string $url
* @param string $post
* @param string $token
@h4de5
h4de5 / wsl-ssh-pageant.md
Last active October 2, 2023 13:33
Use putty's SSH key agent (pageant) from windows in WSL bash - no more "ssh-add" needed

prepare on windows cmd

see: https://github.com/benpye/wsl-ssh-pageant

mkdir workspace
cd workspace
git clone git@github.com:benpye/wsl-ssh-pageant.git
cd wsl-ssh-pageant
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /out:wsl-ssh-pageant.exe Program.cs
@h4de5
h4de5 / gist:2e3fe4997db56325bfbc4a26625c29fb
Last active July 20, 2022 22:46
Synology - Make Plex PMS log to ram (tmpfs)
# change to Plex PMS directory on the nas (volume1 could be different)
cd "/volume1/Plex/Library/Application Support/Plex Media Server"
# stop Plex application for now
sudo synopkg stop "Plex Media Server"
# move away existing logs
mv Logs Logs-bkp
# list directory content
# remember group and userid from user plex and group users
ll -n
# create mount point for the Logs directory with the uid listed above
@h4de5
h4de5 / get_rpi_ip.bat
Last active February 4, 2022 17:10
get IP from Raspberry in Network
@echo off
REM run on windows in elevated cmd line
REM clear arp cache
arp -d
REM TODO: get correct subnet
REM bruteforce through the network
for /L %%a in (1,1,254) do @start /b ping 192.168.0.%%a -w 100 -n 2 >nul
@h4de5
h4de5 / .gitconfig
Last active January 4, 2022 16:35
show differences that would come through git pull
[user]
name = Username
email = your@email.com
[alias]
# fetches the current branch - than does a diff between the working copy and this fetched branch.
# so you should only see the changes that would come with git pull.
diffpull=!git fetch && git diff HEAD..@{u}
# lists all branches
branchlist=!git branch --list -vva
@h4de5
h4de5 / basic-auth-bash.sh
Last active July 20, 2021 15:35
Use basic authentification, ignore invalid and self-signed certificates and parse the request result
token=$(curl --insecure --request GET \
--url "https://localhost:1234/Token" \
--header "$(echo Authorization: Basic $(echo -n 'username:password' | base64))")
# echo $token
# open browser
# xdg-open "https://localhost:1234/?token=" + $token
sensible-browser "https://localhost:1234/?token=" + $token
@h4de5
h4de5 / humble-bundle-download-links.js
Created December 28, 2020 01:46
Humble Bundle Download Link extraction
@h4de5
h4de5 / ledsoff.service
Last active December 9, 2020 21:47
disable leds on rpi3 - when config.txt modification do not work.
[Unit]
Description=Disable leds
After=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c '/bin/echo "none" > /sys/class/leds/led0/trigger'
ExecStart=/bin/sh -c '/bin/echo "0" > /sys/class/leds/led0/brightness'
ExecStart=/bin/sh -c '/bin/echo "none" > /sys/class/leds/led1/trigger'
ExecStart=/bin/sh -c '/bin/echo "0" > /sys/class/leds/led1/brightness'
@h4de5
h4de5 / content_security_policy.php
Last active October 1, 2020 16:27
Synology Photostation add Google Analytics to shared album
<?php
// beware -- this will make you photostation less secure -- beware
// file: /volume1/\@appstore/PhotoStation/photo/cms/content_security_policy.php
// starting with Photostation 7 (PHP7) the new file to edit is:
// file: /volume1/\@appstore/PhotoStation/photo/include/content_security_policy.php
// rest is the same
// search for script-src
// add 'unsafe-inline'
@h4de5
h4de5 / eletronic-device.md
Last active August 29, 2020 23:37
A plan to get all those electronic/IOT devices ready

IOT devices

Garden irrigation

Device: SONOFF 4CH R2
Device: SONOFF 4CH PRO R2
Steuerung von 3 Garena Ventilen (24v DC) mit 19.5V Netzteil vom laptop.
Adapter von Laptopstecker auf kabel vorhanden.

how to flash firmware: https://www.youtube.com/watch?v=hOFvbdYkOII