Skip to content

Instantly share code, notes, and snippets.


Josh Dick joshdick

Block or report user

Report or block joshdick

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
lorenzoferrante / Shortify.js
Created Dec 2, 2018
Get track or playlist URL from user query
View Shortify.js
// Base64 encoding of your credentials
let clientID = '<your client id>'
let clientSecret = '<your client secret>'
let cred = clientID + ':' + clientSecret
let credEncoded = Data.fromString(cred).toBase64String()
let auth = 'Basic ' + credEncoded
// Get token
let tokenURL = ''
var reqToken = new Request(tokenURL)
ChristoferK / Open URLs in Safari.applescript
Created Jun 17, 2018
[Open URLs in Safari] An AppleScript that receives a list of URLs as input and opens them in new tabs of a specified existing window or, optionally, a new window, and can be set to do this in the background or by raising Safari to the foreground #Safari #tabs #URLs #AppleScript
View Open URLs in Safari.applescript
property S : a reference to application "Safari"
global W
on run input -- input is a list of URLs
if (count input) is 0 then ¬
set the input to
"", ¬
"stackoverflow", ¬
joepie91 / .md
Last active Aug 22, 2019
Running a Node.js application using nvm as a systemd service
View .md

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!

The original article

Trickier than it seems.

marcoarment / FCPrivateBatteryStatus.m
Created Jan 29, 2016
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
View FCPrivateBatteryStatus.m
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
dperelman /
Last active Jul 23, 2019
Download all items in a podcast.
#!/usr/bin/env python
from __future__ import print_function
import datetime
import feedparser
import time
import os
import sys
from six.moves import urllib
lukf / generate_personal_podcast.rb
Last active Oct 15, 2019 — forked from sjschultze/generate_personal_podcast.rb
automatically hosting a podcast in your Dropbox public folder
View generate_personal_podcast.rb
#!/usr/bin/env ruby -wKU
# by Kelan Champagne
# with edits by sjschultze
# and advanced metadata handling by lukf
# A script to generate a personal podcast feed, hosted on Dropbox
# Inspired by
marcoarment / ATPLogoView.m
Created Apr 29, 2014
Source for the Accidental Tech Podcast (ATP) T-Shirt
View ATPLogoView.m
// Source for the Accidental Tech Podcast (ATP) T-Shirt:
// By Marco Arment, April 28, 2014. MIT license.
@implementation ATPLogoView
- (void)drawRect:(CGRect)rectIgnored
NSString *fontName = @"MyriadPro-Semibold";
gruber / Liberal Regex Pattern for Web URLs
Last active Oct 16, 2019
Liberal, Accurate Regex Pattern for Matching Web URLs
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "". For a pattern that attempts to
match all URLs, regardless of protocol, see:
# Single-line version:
XVilka /
Last active Oct 21, 2019
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
ttscoff / barchart.rb
Last active Jan 4, 2019
Command line bar chart from JSON data (for GeekTool, et al)
View barchart.rb
#!/usr/bin/env ruby
# encoding: utf-8
# Brett Terpstra 2013, WTF license <>
# Outputs a vertical bar chart from date-based JSON data
# Requires the JSON rubygem: `[sudo] gem install json`
require 'date'
require 'open-uri'
require 'rubygems'
require 'json'
You can’t perform that action at this time.