Skip to content

Instantly share code, notes, and snippets.

@bruvv
bruvv / Repair synology BTRFS volume
Created December 6, 2019 18:12
Synology BTRFS repair
btrfs fi show -d
(/dev/mapper/vg1000-lv)
syno_poweroff_task -d
(or: umount /volume1)
(or2: umount /volume1 -f -k)
Check to see if all us unmounted:
df -h
@bruvv
bruvv / sync_trv_with_external_temp_sensor.yaml
Last active November 16, 2024 11:33
Sync TRV with external sensor blueprint
blueprint:
name: Sync TRV temperature
description: Sync external temperature sensor with TRV temperature
domain: automation
input:
ieeeaddressoftrv:
name: IEEE Address
description: This is the address of the TRV found in your zigbee database example 0x459877fffe1f2e83
external_temp:
name: Select the external temp sensor
@bruvv
bruvv / synology speed tweaks.md
Last active October 14, 2024 03:19
synology speed tweaks

Note: this was tested and used on DSM5 and partly on 6. Since V7 I am not using this anymore.

Got and ssh into your box. Find what is using swap:

find /proc -maxdepth 2 -path "/proc/[0-9]*/status" -readable -exec awk -v FS=":" -v TOTSWP="$(cat /proc/swaps | sed 1d | awk 'BEGIN{sum=0} {sum=sum+$(NF-2)} END{print sum}')" '{process[$1]=$2;sub(/^[ \t]+/,"",process[$1]);} END {if(process["VmSwap"] && process["VmSwap"] != "0 kB") {used_swap=process["VmSwap"];sub(/[ a-zA-Z]+/,"",used_swap);percent=(used_swap/TOTSWP*100); printf "%10s %-30s %20s %6.2f%\n",process["Pid"],process["Name"],process["VmSwap"],percent} }' '{}' \;  | awk '{print $(NF-2),$0}' | sort -hr | head | cut -d " " -f2-

Update synoinfo.conf to correct memory in MB (https://www.gbmb.org/gb-to-mb) for 8GB:

@bruvv
bruvv / recyclarr.yml
Last active September 5, 2024 12:13
Recyclarr config
# yaml-language-server: $schema=https://raw.githubusercontent.com/recyclarr/recyclarr/master/schemas/config-schema.json
# A starter config to use with Recyclarr. Most values are set to "reasonable defaults". Update the
# values below as needed for your instance. You will be required to update the API Key and URL for
# each instance you want to use.
#
# Many optional settings have been omitted to keep this template simple. Note that there's no "one
# size fits all" configuration. Please refer to the guide to understand how to build the appropriate
# configuration based on your hardware setup and capabilities.
#

How to use this?

  1. Install the USB drivers for your device (Google has a list of some universal USB drivers here)
  2. Download the ADB binary for your particular OS (Windows, Mac, Linux)
  3. Extract the zip file into a folder that you can quickly access.
  4. On your phone, go to Settings and tap on About Phone. Find the Build Number and tap on it 7 times to enable Developer Options.
  5. Now enter Developer Options and find USB Debugging. Enable it.
  6. On your computer, browse to the directory where you extracted the ADB binary.
  7. Launch a Command Prompt in your ADB folder. For Windows users, this can be done by holding Shift and Right-clicking then selecting the “open command prompt here” option.
  8. Once you’re in the command
@bruvv
bruvv / PIHOLE+UNBOUND.md
Last active June 21, 2024 14:33
Setup Pihole + Unbound + DNS over TLS on ubuntu 20.02 LTS

Swap

First enable swap just incase

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
@bruvv
bruvv / pwnagotchi change wlan card.md
Last active March 28, 2024 23:34
pwnagotchi change wlan card

I want to disable monitor mode for the interal wlan0 card of the pi. If you want to do that too and use wlan1 as mon0 do:

sed -i 's/phy0/phy1/g' /usr/bin/pwnlib

If you want wlan0 and wlan1 in monitor mode and want to use wlan1 as pwnagotchi device, use this ps did didn't work for me but above example

sudo su
rm /etc/network/interfaces.d/wlan1-cfg
www.marktplaats.nl##li.hz-Listing:has-text(/Bezoek website/)
www.marktplaats.nl##li.hz-Listing:has-text(/Heel Nederland/)
www.marktplaats.nl##li.hz-Listing:has-text(/Buitenland/)
www.marktplaats.nl##li.hz-Listing:has-text(/BVA Auctions/)
www.marktplaats.nl##li.hz-Listing:has-text(/Hollandia Autolease/)
www.marktplaats.nl###adsense-root
www.marktplaats.nl##div.hz-Banner--fluid.hz-Banner
www.marktplaats.nl##.hz-Listings__container--cas
www.marktplaats.nl###adsense-container
www.marktplaats.nl##.hz-SuggestedSearches-popularKeywordPageLink

We are going to use the acme.sh script to accomplish this. For authentication of the domain name, we will use the DNS option. First login to your Synology with ssh as the admin user and then sudo -i to get root access. When you login into the Synology with ssh you will end up in the /root path. I assume for the rest of the guide we run everything from that path. Now we need to get the script and change the permissions so it is executable.

wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh
chmod a+x acme.sh

Next we issue the certificate:

./acme.sh --issue -d *.website.come --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
@bruvv
bruvv / iptables.sh
Last active October 22, 2023 11:53
#!/bin/bash
# flush the nat and mangle tables, flush all chains (-F), and delete all non-default chains (-X)
iptables -F
iptables -X
iptables -t mangle -F
ip6tables -X
ip6tables -t mangle -F
ip6tables -F
# accept all