Skip to content

Instantly share code, notes, and snippets.

@nrollr
nrollr / font-face.css
Created February 28, 2016 14:23
Code to include custom Fonts in CSS
@font-face {
font-family: 'name_font';
src:url('fonts/name_font.eot');
src:url('fonts/name_font.eot?#iefix') format('embedded-opentype'),
url('fonts/name_font.woff') format('woff'),
url('fonts/name_font.ttf') format('truetype'),
url('fonts/name_font.svg#bpicons') format('svg');
font-weight: normal;
font-style: normal;
@nrollr
nrollr / SafariToReminders.applescript
Created January 16, 2016 15:16
Save open Safari tabs to Reminders.app
set currentTab to 0
set the dateStamp to ((the current date) as string)
set listName to "Open Safari Tabs, dated: " & the dateStamp
tell application "Safari"
activate
set safariWindow to the front window
set successCount to 0
set tabCount to (count of (tabs of safariWindow))
@nrollr
nrollr / iTunesMediaLocation.sh
Last active November 10, 2018 23:43
Retrieve file location of all items in the iTunes Library
#!/bin/bash
# Extract file location of each item from iTunes Music Library.xml (renamed to iTunes.xml)
sed -n 's/.*<key>Location<\/key><string>\([^<]*\)<\/string>.*/\1/p' iTunes.xml > FileLocation.txt
@nrollr
nrollr / BackupThunderbird.applescript
Last active December 24, 2015 17:24
Applescript to backup Thunderbird directory as .zip File
-- Copy Thunderbird directory to /Users/{username}/Temp/
set mailFolder to ((path to home folder) as text) & "Library:Thunderbird" as alias
set tempFolder to ((path to home folder) as text) & "Temp" as alias
tell application "Finder"
duplicate folder mailFolder to folder tempFolder with replacing
end tell
-- Compress the Thunderbird copy
set destinationFolder to ((path to home folder) as text) & "Temp" as alias
set sourceFolder to ((path to home folder) as text) & "Temp:Thunderbird" as alias
@nrollr
nrollr / SSHKeys.sh
Last active October 2, 2019 06:46
Generate SSH keys
#!/bin/bash/
ls -al ~/.ssh # Lists existing files in your .ssh directory
ssh-keygen -t rsa -b 4096 -C "your_email@domain.com" # Creates new ssh key, using the provided email as label
eval "$(ssh-agent -s)" # Ensure ssh-agent is enabled
ssh-add ~/.ssh/id_rsa # Add ssh key to the ssh-agent
@nrollr
nrollr / ApacheHTTPSConfig.md
Last active March 11, 2024 13:32
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

@nrollr
nrollr / ElCapitan.applescript
Last active July 25, 2016 13:32
Performance improvements for El Capitan
-- Disable Time Machine Local Backups
sudo tmutil disablelocal
-- Disable Automatic Spell Checker
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
-- Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
-- Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
-- Accelerated playback when adjusting the window size (Cocoa applications).
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
@nrollr
nrollr / HTTPCheckStatus.applescript
Created November 29, 2015 11:33
Script to validate list or URL's based on the HTTP status code
-- Replace 'username' in the path with your own (lines 2 & 3)
set inputFile to "/Users/username/Documents/ListURL.txt"
set outputFile to "/Users/username/Documents/StatusURL.txt"
set txtList to paragraphs of (read inputFile)
set {TID, my text item delimiters} to {my text item delimiters, ";"}
repeat with txtLines in txtList
set {theURL} to text items of txtLines
set theScript to "curl -o /dev/null -s -I -w '%{http_code}' " & theURL
@nrollr
nrollr / BulkRename.applescript
Last active December 9, 2021 14:33
Bulk rename files with csv file
-- Store the .csv file in the same directory as the files you wish to rename
-- Replace 'username' in the path with your own (lines 3 & 10)
set csvFile to "/Users/username/Documents/index.csv"
set csvList to paragraphs of (read csvFile)
set {theID, my text item delimiters} to {my text item delimiters, ","}
repeat with csvLines in csvList
set {oldName, newName} to text items of csvLines
tell application "System Events"
set name of file oldName of folder "/Users/username/Documents/" to newName
@nrollr
nrollr / MySQL.md
Last active October 28, 2020 02:53
Install MySQL on El Capitan using Homebrew

Install MySQL on OS X El Capitan

Normally the installation of MySQL can be achieved with a single command, which executes a script provided by MacMiniVault : bash <(curl -Ls http://git.io/eUx7rg)

However, at the time of writing the script is not compatible with OS X El Capitan (10.11)

Install MySQL using Homebrew

An alternative to the aforementioned installation script is installing MySQL using Homebrew. This gist assumes you already have Homebrew installed, if not first read the article "Homebrew and El Capitan"

Make sure Homebrew has the latest formulae, so run brew update first