Skip to content

Instantly share code, notes, and snippets.

@ljm42
ljm42 / PhotoImport.sh
Last active July 5, 2024 10:44
unRAID - automatically move photos to array
#!/bin/bash
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
## Usage (after configuration):
## 1. Insert camera's memory card into a USB port on your unRAID system
## 2. The system will automatically move (or copy) any images/videos from the memory card to the array
## If jhead was installed, it will automatically rotate images according to the exif data
## 3. Wait for the imperial theme to play, then remove the memory card
## Preparation:
@ljm42
ljm42 / docker-shell
Last active March 20, 2024 07:36
A script to easily "docker exec" into a running Docker container
#!/bin/bash
# easily "docker exec" into a running Docker container
# latest version: https://gist.github.com/ljm42/2b3bfd8ff886015bbce8
# for unRAID, place this script on your flash drive as /boot/custom/docker-shell
# then add this to your go script (without the leading pound sign):
# cp /boot/custom/docker-shell /usr/local/bin
CONTAINERS=`docker ps | awk 'NR==1 {offset=index($0,"NAMES")};NR>1{print substr($0,offset)}' | sort -f | tr "\n" " "`
@Hellowlol
Hellowlol / throttle_nzbclient.py
Last active January 3, 2020 02:48
Simple script to throttle sabnsbd and nzbget
from __future__ import print_function
import argparse
import requests # pip install requests
import sys
from jsonrpclib import jsonrpc # pip install jsonrpclib-pelix
"""
Simple script to throttle nzb clients for plexpy
@zetas
zetas / backup_db_incremental.php
Last active March 8, 2022 19:50
Incremental DB Backup Scripts
<?php
/**
* Incremental DB Backup Script.
*
* Requires: innobackupex percona script.
*
* Meant to run via cron, every 8 hours. It assumes during the fourth
* invocation a day has gone by.
*
* @author Kingcat <kingcat@nzb.cat>
@alirobe
alirobe / reclaimWindows10.ps1
Last active July 31, 2024 08:27
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@austinheap
austinheap / bars.txt
Created October 25, 2016 16:33
Rainbow Pi-hole with screensaver for LCD screens
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
@blacktwin
blacktwin / stream_limiter_ban_email.py
Last active October 27, 2020 21:33
This is indented to restrict a user to the LIMIT amount of concurrent streams. User will be warned, punished, and banned completely if violations continue.
"""
Share functions from https://gist.github.com/JonnyWong16/f8139216e2748cb367558070c1448636
Once user stream count hits LIMIT they are unshared from libraries expect for banned library.
Once user stream count is below LIMIT and banned library video is watched their shares are restored.
Once violation count have been reached ban permanently.
Caveats:
Unsharing doesn't pause the stream.
After unsharing user can pause but not skip ahead or skip back.
@blacktwin
blacktwin / aired_today_playlist.py
Created February 26, 2017 22:25
Create a Plex Playlist with what was aired on this today's month-day, sort by oldest first, using PlexAPI
"""
Create a Plex Playlist with what was aired on this today's month-day, sort by oldest first.
If Playlist from yesterday exists delete and create today's.
If today's Playlist exists exit.
"""
import operator, time
from plexapi.server import PlexServer
import requests
@blacktwin
blacktwin / kill_more_than.py
Last active July 15, 2023 19:05
If user has 2* or more concurrent streams and the IP of the 2nd stream differs from 1st kill 2nd. If 2nd stream IP is the same as 1st stream don't kill.
"""
If user has 2* or more concurrent streams and the IP of the 2nd stream differs from 1st kill 2nd.
If 2nd stream IP is the same as 1st stream don't kill.
*PlexPy > Settings > Notification> User Concurrent Stream Threshold
The number of concurrent streams by a single user for PlexPy to trigger a notification. Minimum 2.
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on user concurrent streams
@blacktwin
blacktwin / notify_fav_tv_all_movie.py
Last active December 19, 2017 22:38
Notify users of recently added episode to show that they have watched at least LIMIT times via email. Also notify users of new movies.
"""
Notify users of recently added episode to show that they have watched at least LIMIT times via email.
Also notify users of new movies.
Block users with IGNORE_LST.
Arguments passed from PlexPy
-sn {show_name} -ena {episode_name} -ssn {season_num00} -enu {episode_num00} -srv {server_name} -med {media_type}
-pos {poster_url} -tt {title} -sum {summary} -lbn {library_name} -grk {grandparent_rating_key}
You can add more arguments if you want more details in the email body