Skip to content

Instantly share code, notes, and snippets.

@nrollr
nrollr / Backup_iPhone_TimeCapsule.sh
Created November 1, 2016 16:42
iOS device backup to Time Capsule
# Create the appropriate directory structure on the TimeCapsule and mount the root folder ('Data' in this example)
# Backup path: /Volumes/Data/iOS/Backup/
$ cp -r ~/Library/Application\ Support/MobileSync/Backup/ /Volumes/Data/iOS
$ cd ~/Library/Application\ Support/MobileSync/
$ rm -r Backup/
$ ln -s /Volumes/Data/iOS/Backup/ ~/Library/Application\ Support/MobileSync/
# Open iTunes select your iPhone/iPad and click 'Back Up Now'-buttom
@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 / 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 / Homebrew.sh
Created October 10, 2015 15:44
List of Homebrew commands
#!/bin/bash
brew update # Ensure you’re running the latest version of Homebrew, including latest list of formulae
brew list # Show everything installed with Homebrew
brew outdated # Show Homebrew installed packages which could be updated
brew upgrade # Update all packages installed by Homebrew
brew upgrade [package] # Update an specific package installed by Homebrew
brew pin [package] # Protect a package, prevents installing upgrades
@nrollr
nrollr / Redis.sh
Created March 29, 2016 11:30
Install Redis via Homebrew
#!/bin/bash
brew install redis # Install Redis using Homebrew
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl
# homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping # Check if the Redis server is running
@nrollr
nrollr / Commands.sh
Last active January 10, 2023 11:55
Install PHP and NGINX on Amazon Linux AMI
## Install NGINX
## when installing on Amazon Linux AMI, use:
$ sudo yum install nginx -y
## when installing on Amazon Linux 2 AMI, use
$ sudo amazon-linux-extras install nginx1.12 -y
## Install PHP and PHP-FPM
# for PHP version 7.1 use php71 and php71-fpm instead
$ sudo yum install php -y
$ sudo yum install php-fpm -y
@nrollr
nrollr / Node_AWS_Linux.md
Last active May 7, 2023 14:18
Install Node.js on Amazon Linux (EC2)

Installing Node.js on Amazon Linux AMI

The following will guide you through the process of installing Node.js on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes

For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI (ami-d41d58a7). Once the EC2 instance is up-and-running, connect to your server via ssh

@nrollr
nrollr / Python.md
Last active June 6, 2023 23:16
Python environments in macOS

Python environments in macOS

The latest version of macOS 10.13.3 has Python 2.7.10 installed by default, yet Python has been available on macOS and previously OS X for quite a while now.

Consult the Apple's Open Source Reference Library, and browse through the various releases of the OS to find out which Python version was included). But what if you have a project which requires Python 3 ?

The following instructions will guide you through the process of:

  • installing Python 3 using Homebrew
  • running multiple Python verions as sandboxed environments
@nrollr
nrollr / hash.py
Created August 17, 2023 10:12
Hash instance types
import json
from hashlib import blake2b
json_content = json.load(open('json_file.json'))
items = []
for item in json_content:
items.append(item['instance_type'])
for i in items:
instance = i
@nrollr
nrollr / MongoDB.md
Last active January 7, 2024 11:57
Install MongoDB on El Capitan

Install MongoDB on El Capitan

How to install the latest stable version of MongoDB on OS X 10.11 (El Capitan).

  • Official MongoDB install documentation: Here
  • Current Stable Release: 3.0.6

Make sure you have Homebrew installed before following the different steps documented below.
Important notice: When installing Homebrew on El Capitan there is an important article you should read first: Homebrew and El Capitan