Skip to content

Instantly share code, notes, and snippets.

@julcap
julcap / WiiUKeyMerger.py
Created August 10, 2022 14:56
Merge and parse WiiU key files
# Instructions
# Run: python WiiKeyMerger.py file1.txt file2.txt
import os
import sys
OUTPUT_FILE = "merged_keys.txt"
def parse_and_remove_duplicates(file1, file2):
if os.path.exists(OUTPUT_FILE):
@julcap
julcap / mount_cifs.sh
Created November 20, 2021 13:52
Create local folders and mount remote cifs shares
# The standard way to add automatic mount is using /etc/fstab. The problem i found is that when remote shares are offline
# the computer is slow to boot because it waits for each entry in /etc/fstab to time out.
# Here i am automating the mounting of remote shares so i can run it after computer has finished boot via cronjob or manually.
# This script creates local directories if they do not exists and mounts the remote shares using cifs.
#!/usr/bin/env bash
IFS=,
MOUNT_ROOT=/mnt
REMOTE_FOLDERS="ubuntu,proxmox,TV Shows,Steam,Music,Mix,Learning,Movies,Emulators,Music Videos"
REMOTE_SERVER_IP=192.168.50.253
@julcap
julcap / archive.sh
Created November 19, 2021 15:34
Automation to enctrypt/decrypt folders
#!/usr/bin/env bash
if [ ! $1 ]; then
echo -e "Usage\n"
echo -e "$0 { FOLDER | ENCRYPTED FILE }\n"
exit
fi
if [ -d $1 ]; then
tar cz $1 | openssl enc -aes-256-cbc -pbkdf2 -e > $1.encrypted
@julcap
julcap / transmission.sh
Created January 2, 2021 13:20
Handle transmission-daemon
#!/usr/bin/env bash
EXECUTABLE_NAME="transmission-daemon"
USER="debian-transmission"
WORKDIR="/var/lib/transmission-daemon/.config/transmission-daemon"
function start {
sudo -u $USER $EXECUTABLE -f --log-error -g $WORKDIR &
}
@julcap
julcap / qbittorrent.sh
Last active December 25, 2020 16:11
Control qbittorrent-nox running in back ground as service.
#!/usr/bin/env bash
function start {
$exe -d --webui-port=4713 --configuration=/etc/default/qbittorrent-nox --save-path=/etc/default/qbittorrent-nox/torrents
}
function status {
PROCESS=$(ps aux | grep qbittorrent-nox | grep -v 'grep')
PROCESS_ID=$(echo $PROCESS | awk -F" " '{print $2}')
}
#!/usr/bin/env bash
export USER="user"
export AUTHORIZED_KEYS="/home/$USER/.ssh/authorized_keys"
export KEY="public key"
if [ "$1" == "-c" ];then
echo "Creating user $USER"
useradd -m -s /bin/bash $USER
fi
@julcap
julcap / aliases.txt
Created June 18, 2018 08:18
Bash aliases
Aliases (.bashrc )
alias ll='ls -lah'
alias l='ll'
alias updateme="sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y"
screen (.screenrc)
# Set the window caption.
# I use caption instead of hardstatus, so it is available per split window too
# (hardstatus is only per complete screen).
caption always "%{= KW}%-Lw%{= wb}%n %t %{= KW}%+Lw %-=| ${USER}@%H | %M%d %c%{-}"
@julcap
julcap / delete_s3_all_bucket_versions.py
Created August 31, 2017 11:35
Delete all bucket object versions
#!/usr/bin/env python
BUCKET = 'your_bucket_name'
import boto3
s3 = boto3.resource('s3')
for obj in s3.Bucket(BUCKET).object_versions.all():
print(obj.delete())
@julcap
julcap / Logstash_index_management.sh
Created June 12, 2017 09:14
Manage Logstash indices, remove data of specific type
#!/bin/sh
indices="$(curator show indices --all-indices)"
_type="activitylog-syslog"
opt=$1
if [ ! "$1" ];then opt='False';fi
case $opt in
@julcap
julcap / id_and_email_validation.sh
Last active August 15, 2016 13:08
Shell script to validate numeric ID and email in CSV file
# The purpose of this script is to validate CSV file containing two columns,
# ID and email. ID is an integer, email can be quoted.
# It will catch inconsistent quotation marks, invalid emails and ID that is not numberic.
# Valid line examples:
# 1234567890;'email@address.com'
# 1234567890;"email@address.com"
# 1234567890;email@address.com
#!/usr/bin/env sh