Skip to content

Instantly share code, notes, and snippets.

View xenotropic's full-sized avatar

Joseph Morris xenotropic

View GitHub Profile
@xenotropic
xenotropic / nerd-dictation-punctuation.py
Last active February 10, 2022 20:47
Punctuation and capitalization commands for nerd-dictation
# This is a partial ~/.config/nerd-dictation/nerd-dictation.py file
# I wanted to be able to dictate punctuation and capitalization.
# This is GPLv3, following nerd-dictation's license
# Following vars set the word(s) will capitalize/all caps the next word.
# Make them whatver words suit your fancy
cap_token="capitalize"
all_cap_token="all caps"
@xenotropic
xenotropic / etc-hosts-normal
Created October 13, 2021 18:44
/etc/hosts block facebook twitter reddit
# May need to add IPv6 someday but for now these work for me
# I keep this as a file called "/etc/hosts.normal" (since "normally" social media should be off on my work computer)
# and then a more typical hosts file (whatever you had to start with) as "/etc/hosts.social-media-allow"
# so can easily switch them by copying
# Block Facebook IPv4
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
@xenotropic
xenotropic / ffcompand.sh
Created April 14, 2021 19:11
ffmpeg compand Dynamic Range Compression
#!/bin/bash
# Dynamic range compression via ffmpeg. Takes single filename as input, writes temporarily to a file in tempdir, then copies back (and overwrites!) to the original location.
# Because of the overwrite, make sure you're working with a backed-up file, at least at first.
# Based on https://medium.com/@jud.dagnall/dynamic-range-compression-for-audio-with-ffmpeg-and-compand-621fe2b1a892
tempdir=/home/joe/temp/ #modify to be a place writable by the script
extension="${1##*.}"
ffmpeg -y -err_detect ignore_err -copyts -i "$1" -filter_complex "compand=attacks=0:po
@xenotropic
xenotropic / create_htaccess_allow_fb.php
Created July 23, 2020 23:23
Script to create htaccess file for simple auth, but also allow FB crawler in by IP address
# Creates an .htaccess file that sets up simple auth (use SSL only!) but allows FB IP address through
# FB indicates its IP addresses shift often, so will need to be cronned
# See https://developers.facebook.com/docs/sharing/webmasters/crawler
# MIT License https://opensource.org/licenses/MIT
# You need to create and update location of AuthUserFile, your php interpreter
#!/usr/bin/php
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/location/of/.htpasswd"