Skip to content

Instantly share code, notes, and snippets.

Paul Wenzel pwenzel

Block or report user

Report or block pwenzel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pwenzel
pwenzel / unserialize_clipboard.fish
Last active Feb 12, 2019 — forked from gregferrell/php_unserialize.sh
Fish shell function to unserialize php from the OSX clipboard.
View unserialize_clipboard.fish
# ~/.config/fish/functions/unserialize_clipboard.fish
# unserialize PHP from the clipboard
# based on https://gist.github.com/gregferrell/747642
function unserialize_clipboard
set STRING (pbpaste)
php -r "echo var_dump(unserialize('$STRING'));"
end
@pwenzel
pwenzel / handle_host_ping.fish
Last active Nov 8, 2018
Ping host and do something if it's down. Example showing how to use and/or operator in Fish shell
View handle_host_ping.fish
ping -q -c 1 bogus.local; and echo "pinging the host worked"; or echo "pinging the host didn't work"
ping -q -c 1 google.com; and echo "pinging the host worked"; or echo "pinging the host didn't work"
@pwenzel
pwenzel / concatenate_csv.sh
Created Jan 25, 2018
Concatenate CSV files with sed
View concatenate_csv.sh
# Concatenate CSV files to all.csv in parent directory
# Assumes they all have the same CSV header
# https://stackoverflow.com/questions/9633114/unix-script-to-remove-the-first-line-of-a-csv-file/9633203#9633203
sed 1q *.csv > ../all.csv
sed 1d *.csv >> ../all.csv
@pwenzel
pwenzel / TransmissionPushover.sh
Created May 22, 2016
Send iOS push notification when torrent is complete, via Pushover
View TransmissionPushover.sh
#!/bin/sh
#
# Send push notification to pushover device when a torrent is complete.
#
# Requires: Pushover account, Transmission torrent client and curl.
#
# Get the API token from the pushover website.
# Change text output below if you wish.
# Set Transmission to start script when torrent is complete.
@pwenzel
pwenzel / ffmpeg-mkv-to-mp4.sh
Last active Aug 25, 2019
MKV and AVI to MP4 Conversion for Apple TV
View ffmpeg-mkv-to-mp4.sh
# See also https://trac.ffmpeg.org/wiki/Encode/AAC
# direct copy
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
# direct copy video, but convert audio to AAC with default variable bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental output.mp4
# direct copy video, but convert audio to AAC with constant bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 320k output.mp4
@pwenzel
pwenzel / firebase.json
Last active Dec 7, 2015
Possible to achieve wildcard redirects in Firebase? (Note: this does not actually work)
View firebase.json
{
"firebase": "example-site",
"public": "public",
"redirects": [
{
"source" : "/blog/**/**",
"destination" : "http://blog.example-site.com/$1",
"type" : 302
}
]
@pwenzel
pwenzel / rbenv-fish-setup.md
Last active Aug 7, 2019
Installing rbenv in a fish environment
View rbenv-fish-setup.md

Here we use Homebrew to install rbenv:

  1. brew update; and brew install rbenv ruby-build
  2. Add ~/.rbenv/shims to your PATH
  3. Include the contents of completions/rbenv.fish in your Fish config.
  4. Run rbenv install 2.2.2 and rbenv rehash
  5. Run rbenv global 2.2.2

Now you can run gem install bundler and bundle install within your Ruby project.

@pwenzel
pwenzel / 404-error-tracking.html
Created Feb 20, 2015
Track 404 errors as events with Google Universal Analytics, capturing the referrer as well.
View 404-error-tracking.html
<script type="text/javascript">
// Track 404 errors with Universal Analytics
if($('body').hasClass('error404')) {
ga('send', 'event', 'error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer, {'nonInteraction': 1});
}
</script>
View Spot the Hijack
* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Make sure you are already recording in Audio Hijack Pro with a session called 'spotifySession' *)
tell application "Spotify"
set currentTrack to (current track)
set trackName to (name of currentTrack)
tell application "Audio Hijack Pro"
set theSession to my getSession()
end tell
repeat
View trinkup
#!/bin/bash
#
# trinkup - TRivial INcremental bacKUP script
#
# Licensed under DWTFYWWI license, but recommended to be used before drinkup.
#
set -e
if ! which rsync >/dev/null; then
You can’t perform that action at this time.