Skip to content

Instantly share code, notes, and snippets.

View fabacab's full-sized avatar
💭
Send issue reports, patches, or money. No more talk.

0xACAB fabacab

💭
Send issue reports, patches, or money. No more talk.
  • Code signing GPG key: 0x15FC01926CB6D75614790893B0303BF6BA36A560
View GitHub Profile
@fabacab
fabacab / relativize-playlist.sh
Created November 18, 2022 22:11
Read an M3U playlist file exported from Apple Music and relativize the paths, copying content from the original location to the relative location.
#!/bin/bash -
#
# Given a playlist, expected in M3U format, copies
# the songs listed in said playlist to the given
# output directory, creating a new playlist using
# relative path names. This new folder can then be
# shared more easily.
playlist="$1" # Path to an M3U file.
tmpfile="$(mktemp playlist.XXXXX)"
@fabacab
fabacab / signal-switch.sh
Created July 1, 2020 19:06
Signal Switch - Signal Desktop switcher that makes it easy to flip between two different Signal accounts installed on the same macOS user account
#!/bin/bash -x
#
# Switch out one Signal Desktop installation for another.
#
APPSUPPORT_DISABLED="$HOME/tmp/Library-DISABLED/Application Support"
mkdir -p "$APPSUPPORT_DISABLED"
@fabacab
fabacab / contact-split.sh
Created October 31, 2017 20:42
Bash script to separate a single vCard containing multiple contacts into multiple vCard files each with its own contact.
#!/bin/bash -
#
# Bash script to separate a single vCard containing multiple contacts
# into multiple vCard files each with its own contact.
#
# Usage:
#
# ./contact-split.sh < INPUT_FILE.vcf
#
# where INPUT_FILE.vcf is, of course, the monolithic vCard file.
@fabacab
fabacab / class-http-reader.php
Last active January 31, 2021 11:55
Pairing interview code sample. Use `php server.php` to start the server, then access http://localhost:4000/set?somekey=someval as per pairing interview instructions.
<?php
/**
* Adds HTTP protocol support to the server.
*
* @package RecurseCenter\Interivew\SocketServer
*/
require_once dirname(__FILE__) . '/interface-rcinterview-reader.php';
/**
* HTTP protocol reader.
@fabacab
fabacab / cg-make-snapshot.sh
Last active August 29, 2023 06:37
Create a static snapshot (HTML mirror) of a Crabgrass group. THIS GIST IS STALE. PLEASE REFER TO https://github.com/meitar/crabgrass-tools for updated information.
#!/bin/bash -
#
# File: cg-make-snapshot.sh
#
# Description: A utility script that takes a static snapshot of any
# Crabgrass group that you have access to.
#
# Examples: Use cg-make-snapshot.sh to create a mirror containing
# the contents of a Crabgrass group.
#
@fabacab
fabacab / xl2sqlite.py
Created November 5, 2015 08:08
Convert a set of similarly-structured .xlsx files into a SQLite DB (using openpyxl and sqlite3).
#!/usr/bin/env python
#
# Convert a set of similarly-structured .xlsx files into a SQLite DB.
#
# For example, say you have hundreds of Excel files in a directory
# called "big-analysis-project" and that each of these Excel files
# has a worksheet containing the same set of columns. Rather than
# having hundreds of separate Excel files, it would be handy to have
# all their data inside one relational database management system.
#
@fabacab
fabacab / uninstall-GHfM.sh
Last active August 29, 2015 14:12 — forked from lukehefson/uninstall-GHfM.sh
Uninstall GitHub for Mac, updated for December 2014
#!/bin/bash
function remove_dir () {
rm -rf "$1_"
if [ -d "$1" ]
then
mv "$1" "$1_"
fi
}
@fabacab
fabacab / faade-find-paying-users.php
Created May 6, 2013 02:40
Cross-reference data in the FetLife Alleged Abusers Database Engine against the the live FetLife site to determine which users accused of violating consent are also paying supporters of FetLife.com. (Output is provided on STDOUT as CSV data, ready for importing to a data analysis tool, such as a spreadsheet. Script progress is reported on STDERR…
<?php
// You need to use the FetLife.php library available at GitHub, here:
// https://github.com/meitar/libFetLife/blob/fbf4123eb1682369d8a4ad86011b87e3717297af/FetLife.php
require_once 'libFetLife/FetLife.php';
if (!defined('STDIN') || !defined('STDERR')) { die('Please run this from the command line.'); }
// Obviously(?) replace the USERNAME with a username that can log in to FetLife, and the PASSWORD with that user's password.
$FL = new FetLifeUser('USERNAME', 'PASSWORD');
// Uncomment this next line to use a local SOCKS proxy, like Tor.
//$FL->connection->setProxy('localhost:9050', CURLPROXY_SOCKS5);