Skip to content

Instantly share code, notes, and snippets.

@hutattedonmyarm
hutattedonmyarm / update_rss_bridge.sh
Last active December 6, 2021 07:06
Updating RSS-Bridge
#!/bin/bash
# Updates rss-bridge to the latest Github release
# Prerequsitions: The dependencies for rss-bridge need to be installed
# This script uses jq, but falls bacl to using grep if jq cannot be found
RSS_BRIDGE_FOLDER="/var/www/html/rss-bridge/" # Edit this to point to the folder you want rss-bridge installed to
REPO="RSS-Bridge/rss-bridge"
GH_API_URL="https://api.github.com/repos/${REPO}/releases/latest"
VERSION_FILE="${RSS_BRIDGE_FOLDER}version.txt"
CACHE_FOLDER="${RSS_BRIDGE_FOLDER}cache"
@hutattedonmyarm
hutattedonmyarm / mp3ToOvercast.py
Last active January 13, 2020 22:35
Splits audiobooks (M4B, single MP3, 1 MP3/chapter) into chapter files, but with a minimum of 90 minutes and uploads them to Overcast
import os
import subprocess
import glob
import sys
import json
import re
import requests
from bs4 import BeautifulSoup
from colorama import Fore
from colorama import Style
@hutattedonmyarm
hutattedonmyarm / RungapGPX.py
Last active October 17, 2023 08:48
Rungap for iOS exports GPS data as JSON file in the free version. This script converts it to GPX. Tested with python3.6. Might need to install required modules. Simply place either the metadata and data json files, or the complete zip file in the same directoryas the script and run it. Warning: Does barely any error checking
import xml.etree.cElementTree as ElementTree
import json, pytz, zipfile, unicodedata, re
from datetime import datetime
from os import listdir
from os.path import isfile, join
import glob
def slugify(value):
"""
Normalizes string, converts to lowercase, removes non-alpha characters.
@hutattedonmyarm
hutattedonmyarm / pnutpy_channel_names.py
Last active November 14, 2017 20:12
Get names of all subscribed channels
import pnutpy
response, meta = pnutpy.api.subscribed_channels(include_raw=True)
print("Response\n")
for channel in response:
raw = channel.get('raw')
if raw is not None and len(raw) > 0:
print(raw[0].get('value').get('name'))
<?php
$html = file_get_contents('https://wiki.pnut.io/PCA');
$doc = new DOMDocument();
$doc->loadHTML($html);
$tables = $doc->getElementsByTagName('table');
$pca = array();
foreach ($tables as $table) {
if ($table->hasAttribute('class') && $table->getAttribute('class') == 'wikitable') {
Freeman:~ max$ ayadn mentions @hutattedonmyarm
Daybreak database /Users/max/ayadn/hutattedonmyarm/db/users.db was not closed, state might be inconsistent
Daybreak database /Users/max/ayadn/hutattedonmyarm/pagination/index.db was not closed, state might be inconsistent
/Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/journal.rb:100:in `initialize': Permission denied - /Users/max/ayadn/hutattedonmyarm/pagination/pagination.db (Errno::EACCES)
from /Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/journal.rb:100:in `open'
from /Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/journal.rb:100:in `open'
from /Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/journal.rb:11:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/db.rb:24:in `new'
from /Library/Ruby/Gems/2.0.0/gems/daybreak-0.3.0/lib/daybreak/db.rb:24:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/ayadn-1.8.2/lib/ayadn/databases.rb:54:in `new'
NSURL *markerURL = [NSURL URLWithString:@"https://api.app.net/posts/marker"];
NSURLResponse *response = nil;
NSError *error = nil;
NSString *post = [NSString stringWithFormat:@"{ \"name\": \"channel:%d\", \"id\": \"%d\" }", channelID, mesageID];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu",(unsigned long)[postData length]];
NSDictionary *headers = @{@"Content-Type" : @"application/json", @"Content-Length" : postLength};
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:markerURL];
request.HTTPMethod = @"POST";
request.HTTPBody = postData;