Skip to content

Instantly share code, notes, and snippets.

View pirtleshell's full-sized avatar
🕺
laniakean explorer

Robert Pirtle pirtleshell

🕺
laniakean explorer
  • Portland, OR
View GitHub Profile
@pirtleshell
pirtleshell / .htaccess
Created October 28, 2016 19:49
Move web root (document root) of a server to a subdirectory on Apache using .htaccess
# I had such a hard time finding this information, so I decided to keep it here.
# Change your server's pointing "example.com" from "/public_html/" to "/public_html/subdir" **without** changing the URL!
# URL remains the same, server directory changes
# Replace "example.com" with your domain and "subdir" with the directory your site is in.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC]
@pirtleshell
pirtleshell / submit_acoustid_fingerprint.py
Created December 8, 2016 03:05
Easily create a musical fingerprint from an MP3 and submit it to AcoustId with musicbrainz recording id (must be embedded in MP3).
import acoustid # the library for creating the fingerprints
import urllib.request # for sending the request to AcoustId's server
from mutagen.id3 import ID3 # for extracting the musicbrainz recording id
def main():
api_key = YOUR_API_KEY # find it at https://acoustid.org/api-key
path = '/path/to/directory/of/music'
songs = ['song1.mp3', 'anothersong.mp3'] # an array of the songs in that path
paths = [path + song for song in songs]
for i,song in enumerate(paths):
@pirtleshell
pirtleshell / git-multipick.sh
Created March 22, 2018 21:41
A quick script to git cherry-pick multiple commits to the current branch. Great for setting up commits in an order that makes sense for things like squashing non-sequential commits
#! /bin/bash
# list all commit refs, one per line.
# edit these before running:
COMMITS='5e5138a8a2
f190eb81ff
9462a4ab68'
# if you have all your commit refs listed in a file,
# do something like this:
@pirtleshell
pirtleshell / wanna-commit.sh
Created April 18, 2018 00:35
wanna commit? bash boilerplate
# this bad boy checks for uncommitted changes, and if there are some, it
# asks you if you want to commit. if you do, it adds everything and asks
# one more time. You enter either a commit message or 'cancel'.
if [[ -z `git status --porcelain` ]]; then
echo your branch is clean, do stuff
else
echo -n you have uncommitted changes, do you want to commit?' '
read WANT_COMMIT
if [[ $WANT_COMMIT == 'y'* ]]; then
@pirtleshell
pirtleshell / keybase.md
Created August 9, 2020 22:09
Keybase proof

Keybase proof

I hereby claim:

  • I am pirtleshell on github.
  • I am pirtleshell (https://keybase.io/pirtleshell) on keybase.
  • I have a public key whose fingerprint is B4CF 144D 0A78 452D 2AB7 7471 62A1 7FA6 6B29 07B6

To claim this, I am signing this object:

@pirtleshell
pirtleshell / .htaccess
Created August 10, 2020 01:08
Dynamic webpage generation with Apache & PHP from a binary
<IfModule mod_rewrite.c>
RewriteEngine on
# redirect all non-existent requests to index.php
RewriteCond %{REQUEST_FILENAME} !-s [OR]
RewriteCond %{REQUEST_FILENAME} !-l [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [NC,L,QSA]
</IfModule>