Skip to content

Instantly share code, notes, and snippets.

@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 / _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 / 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 / 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

@h4de5
h4de5 / create_bare_git.sh
Created February 18, 2020 14:51
Create a bare git repository which allows pushing from other users of the same user group.
#!/bin/bash
# usage ./create_bare_git.sh ProjectName
git init --bare --shared=group "$1.git"
LAST_USERGROUP=`groups | awk '{ print $NF }'`
# CURRENT_DIR=`pwd`
CURRENT_DIR=`realpath .`
chgrp -R $LAST_USERGROUP "$1.git"
@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 / plex_update.sh
Created December 19, 2018 00:24
Manual package (plex) update on Synology
#!/bin/bash
# see infos from:
# https://www.plex.tv/media-server-downloads/
# https://downloads.plex.tv/plex-media-server/1.14.1.5488-cc260c476/PlexMediaServer-1.14.1.5488-cc260c476-x86_64.spk
# first !!
# download plex sign key: https://downloads.plex.tv/plex-keys/PlexSign.key
# install it into package manager on the DSM
@h4de5
h4de5 / install-node-npm-wsl.sh
Created December 4, 2018 10:51
Install nodejs with npm support on WSL (Bash for windows)
#!/bin/bash
# have a look here: https://github.com/creationix/nvm
# will install it into ~/.nvm/
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
# restart bash
# list available nodejs versions
nvm ls-remote
@h4de5
h4de5 / install-mongodb-wsl.sh
Last active June 19, 2020 00:47
Install mongodb v4 on WSL (windows bash)
#!/bin/bash
# make sure you are on latest wsl release (bionic)
cat /etc/*release*
# add new repositories
echo "deb [ arch=amd64,i386 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
echo "deb [ arch=amd64,i386 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.1 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.1.list
# try an update (which will fail, but reveal missing keys)