Skip to content

Instantly share code, notes, and snippets.

View davmillar's full-sized avatar

David Millar davmillar

View GitHub Profile
@markwk
markwk / pdf_toc_processor.py
Created October 3, 2019 19:30
Append a Table of Contents (TOC) to a PDF Document on Mac using Only Python and No External Dependencies
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
#############################
#
# Append a Table of Contents (TOC) to a PDF Document on Mac using Python
#
# This script involves no external dependencies. Works and tested on Mac's default version of Python.
#
# Usage: python pdf_toc_processor.py -i <path-to-target.pdf> -b <path-to-bookmarks-file.txt> -o <path-to-output.pdf>
@adactio
adactio / beforeInstallPrompt.js
Created August 3, 2018 09:31
Show a dismissable option to add The Session to the home screen (only shown to logged in users).
(function (win, doc) {
win.addEventListener('beforeinstallprompt', function (e) {
e.preventDefault();
var deferredPrompt = e;
var insertionPoint = doc.querySelector('main .contents');
insertionPoint.insertAdjacentHTML('afterbegin',`
<div class="feedback" role="dialog" aria-labelledby="homescreen">
<h2 id="homescreen">Install The Session</h2>
<p>Would you like to add The Session to your home screen?</p>
<button class="back">No, thanks</button>
anonymous
anonymous / dontforget.sh
Created August 5, 2016 11:06
Quick reminders from Terminal (bash) - Linux version
#!/usr/bin/env bash
# dontforget
# Description: A stupid script for short term reminders in bash
# Requires: espeak, mpg123, notify-send, ogg123 (vorbis-tools)
# Source: http://brettterpstra.com/2016/01/22/quick-reminders-from-terminal
# Usage:
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@jgravois
jgravois / _webserver.md
Last active November 17, 2024 12:32
a simple guide for getting a local web server set up

Do I have a web server running?


having a web server turned on doesn't necessarily mean you are serving pages on the world wide web. its what allows you to load your own static files (.html, .js etc.) in a browser via http://.

if you're not sure whether or not you have a web server running, no problem! its easy to confirm.

what happens when you visit http://localhost/?

@nullfieldio
nullfieldio / install-tmux
Last active November 16, 2015 22:40 — forked from rothgar/install-tmux
Install tmux 2.0 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL http://sourceforge.net/projects/levent/files/libevent-2.0.22-stable.tar.gz
tar -xvzf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/usr/local
Broken:
Sidebar:
- Nate McD, Matt Joyce, PinkClouds, WarrenAbox; the small icon to the left of the artists name is broken; can you confirm if this is broken for you?
Suggestions:
- combo boxes could use tool tips to explain their functionality further.
- not immediately obvious; had to experiment to figure it out. Expected standard "mouse mode" controls, where clicking "rotate" will allow you to rotate any tile you clicked on.
Map Type:
- "Dungeons" looks like a header, especially when you expand the combo box, making it appear less like an item in the combo box. Considering giving this an actual header?
@davidhund
davidhund / pragmatic-touch-icons.md
Last active November 6, 2024 14:26
Pragmatic Touch Icons

NOTE I'm trying to find the most optimal fav/touch icon setup for my use-cases. Nothing new here. Read Mathias Bynens' articles on re-shortcut-icon and touch icons, a FAQ or a Cheat Sheet for all the details.

I'd like to hear how you approach this: @valuedstandards or comment on this gist.

The issue

You have to include a boatload of link elements pointing to many different images to provide (mobile) devices with a 'favicon' or 'touch icon':

![Touch Icon Links](https://o.twimg.com/2/proxy.jpg?t=HBj6AWh0dHBzOi8vcGhvdG9zLTYuZHJvcGJveC5jb20vdC8yL0FBRGFGY1VRN1dfSExnT3cwR1VhUmtaUWRFcWhxSDVGRjNMdXFfbHRJWG1GNFEvMTIvMjI3OTE2L3BuZy8xMDI0eDc2OC8yL18vMC80L1NjcmVlbnNob3QlMjAyMDE1LTA0LTE0JTIwMTYuNTYuMjYucG5nL0NNejBEU0FCSUFJZ0F5Z0JLQUkvNGR1eDZnMzZmYnlzYWI3

@mullnerz
mullnerz / archive-website.md
Last active October 18, 2024 19:14
Archiving a website with wget

The command I use to archive a single website

wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P . www.foo.com

Explanation of the parameters used

  • -m (Mirror) Turns on mirror-friendly settings like infinite recursion depth, timestamps, etc.
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active September 28, 2024 22:54
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.