Skip to content

Instantly share code, notes, and snippets.

@Sircular
Sircular / anagram.go
Created July 21, 2019 03:15
A single-file Go program to find anagrams for a phrase.
package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"sort"
"strings"
@Sircular
Sircular / audible-split.sh
Created January 9, 2019 16:00
A shell script for splitting Audible audiobooks into mp3 files based on chapter.
#!/usr/bin/env bash
ACTIVATION_KEY="******"
QUALITY="4"
PROCESSES="8"
file=$1
if [ -z "$file" ]; then
echo "Please provide a file."
exit 1;
#!/bin/sh
# Edanywhere: use your editor of choice in favor of whatever text component you
# are given. Inspired by github.com/cknadler/vim-anywhere
# This lets you open an editor of your choice, write some text, and then save
# it. The resulting text will then be copied to your clipboard for easy access.
# Requires xclip.
# If you want to use a different editor than is specified in either $EDITOR or
# $VISUAL, put the path here. I recommend using the full path, rather than just
@Sircular
Sircular / autofold.vim
Created December 25, 2017 18:18
Vimscript to automatically enable marker folding
let s:FoldOpen = split(&foldmarker, ",")[0]
let s:FoldPattern = substitute('^\s*'.&commentstring, '%s', '.*'.s:FoldOpen.'\d*', "")
if searchpos(s:FoldPattern) != [0, 0]
set foldmethod=marker
else
set foldmethod=indent
endif
@Sircular
Sircular / jekyll_publish.sh
Created December 5, 2017 02:40
A script for publishing non-Github Pages themed Jekyll sites to Github Pages.
#!/bin/bash
# Publication script to push the generated site to master
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
PUBLISH_BRANCH="master"
TMP_DIR="/tmp/jekyll_publish"
DATE=$(date +"%D %H:%M:%S")
if [ "$CURRENT_BRANCH" == "$PUBLISH_BRANCH" ]; then
echo "Please switch to the development branch."