Skip to content

Instantly share code, notes, and snippets.

@tonyedwardspz
tonyedwardspz / update_audiobookshelf.sh
Created July 22, 2023 18:34
Script to update Audiobookshelf server in one command
#!/bin/bash
# Replace /path/to/your/docker-compose/directory with the directory path where your docker-compose.yml resides
# Save this somewhere apropriate and give it executable permissions with chmod +x update_audiobookshelf.sh
# You can then run it with ./update_audiobookshelf.sh
# Navigate to the directory where your docker-compose.yml file resides
cd /path/to/your/docker-compose/directory
# Stop the running container
echo "Stopping running container..."
@tonyedwardspz
tonyedwardspz / audiobook file combiner
Created July 18, 2023 10:47
Move files with matching names into their own sub folder within the current directory - Used to help move from Audible to Audiobookshelf
#!/bin/bash
# Loop through all .m4b files in the current directory
for m4b_file in *.m4b; do
# Check if the file exists (in case there are no .m4b files)
if [[ -f "$m4b_file" ]]; then
# Get the filename without extension
base_name="${m4b_file%.*}"
# Check if the corresponding .pdf file exists
@tonyedwardspz
tonyedwardspz / undo-move-files.sh
Created July 3, 2023 12:30
Moves m4b and pdf files into the parent folder
#!/bin/bash
# Loop through all directories in the current directory
for directory in */; do
# Check if it's a directory
if [[ -d "$directory" ]]; then
# Remove trailing slash
dir_name="${directory%/}"
# Construct file names
@tonyedwardspz
tonyedwardspz / move-files.sh
Created July 3, 2023 12:27
Move m4b and PDF files into a subfolder if they have the same name - Used for AudioBookShelf setup
#!/bin/bash
# Loop through all .m4b files in the current directory
for m4b_file in *.m4b; do
# Check if the file exists (in case there are no .m4b files)
if [[ -f "$m4b_file" ]]; then
# Get the filename without extension
base_name="${m4b_file%.*}"
# Check if the corresponding .pdf file exists
@tonyedwardspz
tonyedwardspz / resize.rb
Created May 15, 2023 18:35
Resize images and convert to .jpg, deleting the original files.
#!/usr/bin/env ruby
require 'mini_magick'
require 'fileutils'
begin
size = Integer(ARGV[0])
rescue ArgumentError
puts "Size argument must be an integer."
exit

Keybase proof

I hereby claim:

  • I am tonyedwardspz on github.
  • I am tonyedwardspz (https://keybase.io/tonyedwardspz) on keybase.
  • I have a public key ASA0_Z0UN9j4cIb-2UDxcXqwljwT8CMYeePthl0YcQPc0Qo

To claim this, I am signing this object:

'use strict';
var CACHE_NAME = 'psw-cache-v1';
var urlsToCache = [
'/assets/site-logo.svg',
'/css/main.css',
'/javascript/application.js'
];
self.addEventListener('install', function(event) {
extension UITextField {
func underlined(){
let border = CALayer()
let width = CGFloat(1.0)
border.borderColor = UIColor.lightGrayColor().CGColor
border.frame = CGRect(x: 0, y: self.frame.size.height - width, width: self.frame.size.width, height: self.frame.size.height)
border.borderWidth = width
self.layer.addSublayer(border)
self.layer.masksToBounds = true
@tonyedwardspz
tonyedwardspz / FlipAhead.php
Created November 23, 2015 05:02
Flip Ahead browsing
<?php
$single = (is_single() ? TRUE : FALSE);
if ($single){
$prevPost = get_previous_post();
if (!empty( $prevPost )){ ?>
<link rel="prev" href="<?php echo get_permalink($prevPost->ID); ?>"/>
<?php }
$nextPost = get_next_post();
if (!empty( $nextPost )) { ?>
<link rel="next" href="<?php echo get_permalink($nextPost->ID); ?>"/>