Skip to content

Instantly share code, notes, and snippets.

View wwerner's full-sized avatar

Wolfgang Werner wwerner

View GitHub Profile
@mojavelinux
mojavelinux / slides2png.groovy
Created June 18, 2012 17:27
Export a dzslides presentation to PNGs, then combine into a PDF using geb
/**
* slides2png plays a dzslides presentation using WebDriver, captures each
* slide to a PNG and generates a shell script to collate the PNGs together
* into a PDF using convert (from ImageMagick).
*
* The URL of the presentation is passed as the sole argument to the script.
* If the presentation is local, specify the absolute path prefixed with the
* file:// protocol.
*
* @author Dan Allen
@xavriley
xavriley / drum_tab_player.rb
Created June 10, 2014 21:22
Playing ASCII Drum Tabs with Sonic Pi
# Playing ASCII drum tabs with Sonic Pi
# Ruby is an awesome language for String manipulation.
# Lets use that fact to play some drums!
# Tab for the Amen break taken from Wikipedia
# http://en.wikipedia.org/wiki/Amen_break
# Note that %Q{ ... } is just another way
# to define a string in Ruby
@MaxLaumeister
MaxLaumeister / ipfs.service
Created September 22, 2018 01:57
systemd script for ipfs-daemon run-on-boot
[Unit]
Description=IPFS daemon
After=network.target
[Service]
### Uncomment the following line for custom ipfs datastore location
# Environment=IPFS_PATH=/path/to/your/ipfs/datastore
ExecStart=/usr/local/bin/ipfs daemon
Restart=on-failure
@benclark
benclark / default.vcl
Created May 14, 2012 17:17
Varnish config file w/ basic auth
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}
acl purge {
"localhost";
@cluppi
cluppi / after.sh
Created March 19, 2015 19:01
Turning SSL on for Homestead
#!/bin/sh
# Config for SSL.
echo "--- Making SSL Directory ---"
mkdir /etc/nginx/ssl
echo "--- Copying $i SSL crt and key ---"
openssl req -nodes -new -x509 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj "/C=US/ST=NY/L=NYC/O=Dis/CN=www.example.com"
echo "--- Turning SSL on in nginx.conf. ---"
@hoylen
hoylen / getopt-example.sh
Last active July 23, 2020 11:59
Portable getopt argument processing in shell scripts. Detects which version of getopt is installed. When available, it uses GNU enhanced getopt to support long option names and whitespaces in arguments. Otherwise, defaults to using the original getopt.
#!/bin/sh
#
# Example showing use of getopt detection and use of GNU enhanced getopt
# to handle arguments containing whitespace.
#
# Written in 2004 by Hoylen Sue <hoylen@hoylen.com>
#
# To the extent possible under law, the author(s) have dedicated all copyright and
# related and neighboring rights to this software to the public domain worldwide.
# This software is distributed without any warranty.
@wwerner
wwerner / back-to-origin.sh
Created March 26, 2020 10:46
[git] stash local changes to new branch and reset the current one to its origin
# git safe origin
# -
# save local work to a separate branch and revert to the current branches origin
# I have this in my ~/.zshrc
gso()
{
branch=$(git rev-parse --abbrev-ref HEAD); qualifier=$(date -u +"%Y-%m-%dT%H%M%S") \
&& git add . \
&& git commit -m "Saving local work from $branch to local/stash/$branch-$qualifier" \
&& git branch local/stash/$branch-$qualifier \
@fitnr
fitnr / git-ics
Created December 28, 2015 23:23
git tool for converting log to ICS file
# git-ics
# Place in your $PATH (e.g. ~/bin)
# Accepts any options that can be passed to git log
# usage: git ics [opts] > cal.ics
echo BEGIN:VCALENDAR
echo METHOD:PUBLISH
echo VERSION:2.0
echo PRODID:-//git-ics//git-ics//EN
echo CALSCALE:GREGORIAN
@mraible
mraible / init.lua
Last active June 17, 2021 17:29
My Hammerspoon init.lua
units = {
right30 = { x = 0.70, y = 0.00, w = 0.30, h = 1.00 },
right70 = { x = 0.30, y = 0.00, w = 0.70, h = 1.00 },
left70 = { x = 0.00, y = 0.00, w = 0.70, h = 1.00 },
left30 = { x = 0.00, y = 0.00, w = 0.30, h = 1.00 },
top50 = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 },
bot50 = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 },
upright30 = { x = 0.70, y = 0.00, w = 0.30, h = 0.50 },
botright30 = { x = 0.70, y = 0.50, w = 0.30, h = 0.50 },
upleft70 = { x = 0.00, y = 0.00, w = 0.70, h = 0.50 },
@wwerner
wwerner / v-responsive-class.js
Created October 30, 2020 10:56
Provides a `v-responsive-class` Vue directive to toggle css classes based on the containing element's width.
/**
* Provides a `v-responsive-class` Vue directive to toggle css classes based on the containing element's width.
* Think @media queries, but based on the parent element. Useful for web components.
*
* The breakpoints match the ones in Bootstrap:
* * xs: < 576 - Extra small devices (portrait phones, less than 576px)
* * s: >= 576 - Small devices (landscape phones, 576px and up)
* * m: >= 768 - Medium devices (tablets, 768px and up)
* * l: >= 992 - Large devices (desktops, 992px and up)
* * xl: >= 1200 - Large desktops, 1200px and up