Skip to content

Instantly share code, notes, and snippets.

View brettpetch's full-sized avatar
🌥️
Call me Cloudflare because I'm Always Online™

Brett Petch brettpetch

🌥️
Call me Cloudflare because I'm Always Online™
  • Canada
  • 19:21 (UTC -04:00)
View GitHub Profile
@brettpetch
brettpetch / pandasgraphing_2120_a1.py
Last active December 1, 2019 23:17
How to graph from a pandas dataframe
import pandas as pd # Use pandas instead to map the data easily
import matplotlib.pyplot as plt # Use Matplotlib PyPlot to create graph
import numpy as np # Use Numpy to take mean
def all_temp_plot(filename="London_mean_etr_max_etr_min.csv"):
# Note: This will not drop years with incomplete datsets.
# Read CSV, but only 3 columns because no one cares about the other ones
# then group years, then take mean of months and append it to a new column in a new dataframe.
df = pd.read_csv(filename, delimiter=',', usecols=[0, 1, 2],
def data_check(url='https://s3.amazonaws.com/amazon-reviews-pds/tsv/amazon_reviews_multilingual_US_v1_00.tsv.gz',
file='./data/amazon_reviews_multilingual_US_v1_00.tsv'):
"""
The following function does the following:
1. Check for file to exist
- Go to 3.
2. If file not exists:
a. Check if there is a data folder.
b. If there is no data folder, create one.
c. Download data from the website to the data folder.
@brettpetch
brettpetch / Procfile
Last active April 17, 2024 21:06
The Evil Twitch Spam Bot
worker: spambot.js
#!/bin/bash
# RCLONE UPLOAD CRON TAB SCRIPT
# chmod a+x /media/sdan/ynbldgno/cron/rclone-upload.sh
# Type crontab -e and add line below (without #) and with correct path to the script
# * * * * * /media/sdan/ynbldgno/cron/rclone-upload.sh >/dev/null 2>&1
# if you use custom config path add line bellow in line 20 after --log-file=$LOGFILE
# --config=/path/rclone.conf (config file location)
# Feral config location: /media/sdan/your-username-here/.config/rclone/rclone.conf
if pidof -o %PPID -x "$0"; then
@brettpetch
brettpetch / sonarr-v3-migrate-swizzin.md
Last active September 4, 2020 22:42
Migrating to Sonarr v3 on a Self Hosted Swizzin Instance

Migrating to Sonarr v3 from v2 in Sonarr

This guide assumes using either Debian or Ubuntu. You must have screen installed, as well as wget or curl. Assumption is that your pwd is ~.

Start at: cd ~

Stop Sonarr Service sudo systemctl stop sonarr@yourusernamehere

Disable Sonarr Service (don't worry, we'll fix this later) sudo systemctl disable sonarr@yourusernamehere

Grab the update: wget http://download.sonarr.tv/v3/phantom-develop/3.0.3.913/Sonarr.phantom-develop.3.0.3.913.linux.tar.gz

How to clone an OWL Resources / Dropbox tab to your OneDrive:

Install rclone on your system of choice: https://rclone.org/downloads/

Go to the OWL Resources tab for the class you're going to clone. Copy the link located under the 'transfer files' tab located at the top of the page. Go back to rclone

run rclone config in your command line, press n then enter enter the name of a remote (your source), for this we go to OWL. Set the source to webdav then input the URL from OWL. Press enter, then type in your owl login credentials and keep pressing enter until you reach a yes or no. When you get the yes/no, press y, then hit enter. You've now setup a remote.

To add onedrive to rclone, rclone config then press n then call it onedrive, then type onedrive press enter twice to skip the client ID / client secret section (you'll use a genaric one), then use auto config (press 'y'), it should open a web browser. Login to your UWO address, then when it asks which remote, press 0, enter

@brettpetch
brettpetch / install-hetz.md
Last active March 20, 2024 04:09
Install Images to get up and going on Hetzner.

Plug n' Play Hetzner InstallImage

Cloudbox Config

Ubuntu 18.04, 2 HDD Model For SSD models, please sub in sdX with nvmeXn1.

# Hetzner Online GmbH - installimage
#
# This file contains the configuration used to install this
#!/bin/bash
# BDInfoCLI-ng Install Script
# Requires Swizzin and mono, Still in very very early beta.
# Should sorta-kinda work.
# Elevate like this ``sudo su -``
# Place me at ``/root/`` and ``chmod +x /root/bdinfo-install.sh && ./bdinfo-install.sh``
. /etc/swizzin/sources/globals.sh
. /etc/swizzin/sources/functions/mono
user=$(cut -d: -f1 < /root/.master.info)
@brettpetch
brettpetch / .00-Kutt Install.md
Last active May 9, 2022 21:48
Kutt Installation

Kutt Installation

Introduction

Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics.

Key Features

  • Free and open source.
  • Custom domain support.

Tuning Jellyfin for Large Libraries

Jellyfin, at least in its current state hasn't been great for media server

Database

It is no secret that Jellyfin's database has its shortcomings, espeically when trying to search large media collections. To remedy this, we'll be manually setting some PRAGMA values in the sqlite database.

While it is important to note that these optimizations may cause issues should sudden powerloss occur, it should be pretty safe to run them in an environment like a datacenter, which is where most of my gear resides.