Skip to content

Instantly share code, notes, and snippets.

View eth-p's full-sized avatar

Ethan P. eth-p

View GitHub Profile
@eth-p
eth-p / examples.cpp
Last active March 10, 2018 07:12
A (debatably) small C++ testing library.
#include "testy.h"
using namespace std;
using testy::Expect;
int main() {
// --------------------------------------------
// Basic Usage
// How to run a standalone test.
// --------------------------------------------
@eth-p
eth-p / README.md
Last active April 14, 2018 23:33
A script designed to unidirectionally symlink files between two directories (and move new files back).

Symc

A script designed to unidirectionally symlink files between two directories (and move new files back).

Example

Before:

Source Directory:

~/Dropbox/Work/Meetings/2018/sales.xlsx
~/Dropbox/Work/Assets/2018/Apr/campaign_banner.psd
@eth-p
eth-p / New File.applescript
Last active April 15, 2018 01:02
An applescript for creating a new file in a Finder window.
-- New File.applescript | Copyright (C) 2018 eth-p
-- An applescript for creating a new file in a Finder window.
-- Recommended hotkey: CMD+ALT+N
--
-- This create an "Untitled [number]" file in the frontmost Finder window.
-- The file will automatically be selected and available for renaming.
on run {input, parameters}
tell application "Finder"
if exists Finder window 1 then
@eth-p
eth-p / mwoffliner.sh
Last active May 10, 2018 16:35
mwoffliner (Mac OS X)
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# https://gist.github.com/eth-p/e96f5214a59f5d2694853da6739580b0
# Copyright (C) 2018 eth-p
#
# SUMMARY:
# This is a hackjob script to get mwoffliner (openzim/mwoffliner) working on
# Mac OS X without going through the pain of compiling zimwriterfs and all of
# its dependencies.
#
@eth-p
eth-p / Argument.rb
Created June 20, 2018 11:26
A (messy) Ruby command-line argument parser.
# Copyright (c) 2018 eth-p
# ----------------------------------------------------------------------------------------------------------------------
# Argument:
# A command line argument.
# This is used to describe and validate arguments.
class Argument
# ----- Types -----
@eth-p
eth-p / ident.fish
Last active September 28, 2018 01:16
A better way to manage multiple git users.
# -----------------------------------------------------------------------------
# A function for configuring your user identity.
# Copyright (C) 2018 eth-p
# -----------------------------------------------------------------------------
function ident
set -l GIT_ARGS
set -l arg_global
set -l arg_ident
@eth-p
eth-p / README.md
Last active June 11, 2019 15:09
unraid-custom.css

Installation

Install the following plugin to use custom CSS:

https://raw.githubusercontent.com/eth-p/unraid/master/release/eth-p.unraid.custom-css.plg

Run:

@eth-p
eth-p / Active.lua
Created December 18, 2018 14:14
Rainmeter - Google Play Music Desktop Player
function Initialize()
cached = nil
end
function Check()
local state = SKIN:GetMeasure('measureActive'):GetStringValue()
if state == 'null' then
state = false
else
state = true
@eth-p
eth-p / transfer.sh
Last active December 25, 2018 02:37
https://transfer.sh/ - transfer script with verification prompt
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
# -----------------------------------------------------------------------------
# Verification:
if [ $# -ne 0 ]; then
indev=/dev/stdin
[ -t 0 ] || indev=/dev/tty
@eth-p
eth-p / hgrep.test.sh
Created January 15, 2019 21:04
CMPT 384 - Assignment 1 Test Script
#!/usr/bin/env bash
# ----------------------------------------------------------------------------------------------------------------------
# Compile:
# ----------------------------------------------------------------------------------------------------------------------
ghc hgrep || exit 1
# ----------------------------------------------------------------------------------------------------------------------
# Arguments:
# ----------------------------------------------------------------------------------------------------------------------