Skip to content

Instantly share code, notes, and snippets.

@ivan-leschinsky
ivan-leschinsky / disable.sh
Created November 28, 2017 10:21
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@ivan-leschinsky
ivan-leschinsky / heroku_pg_backup.md
Last active October 30, 2017 20:09 — forked from kagemusha/gist:1569836
Dump Heroku Postgres DB and load locally
@ivan-leschinsky
ivan-leschinsky / install-redis.sh
Last active October 4, 2017 08:18 — forked from FUT/install-redis.sh
Install Redis 4.0.2 on EC2
# 1. Install Linux updates, set time zones, followed by GCC and Make
# sudo yum -y update
# sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
# /etc/localtime
# sudo yum -y install gcc make
# 2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download)

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

@ivan-leschinsky
ivan-leschinsky / my_db.rake
Created August 17, 2016 09:39 — forked from jay16/my_db.rake
rails backup DB
#encoding: utf-8
require "fileutils"
namespace :my_db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7"
desc "usage - bundle exec rake my_db:backup RAILS_ENV=production MAX=15 DIR=db/db.bak"
task :backup => [:environment] do
# config base dir
datestamp = Time.now.strftime("%Y%m%d%H%M")
base_path = Rails.root
backup_folder = File.join(base_path, ENV["DIR"] || "backups")
FileUtils.mkdir_p(backup_folder) unless File.exist?(backup_folder)
@ivan-leschinsky
ivan-leschinsky / rails_application_config.rb
Last active August 29, 2015 14:07 — forked from brentertz/rails
For SEO: Avoid SEO duplicate content issues
config.middleware.insert_before(0, 'Rack::SeoRedirect')
# Configure Rack middleware
config.middleware.insert_before 0, 'WwwRedirect'
@ivan-leschinsky
ivan-leschinsky / application.rb
Last active August 29, 2015 14:07 — forked from brentertz/application.rb
Middleware for robots.txt disallowing
# Disallow site indexing in non-production environments
config.middleware.insert_before(::Rack::Lock, '::Rack::Robots')
module Base62
BASE_CHARS = '0SKVnQFHhGs9qo7p8cRW54duMYNXTCErx2tDmwO3kabfUB1elLvjiIgyJAZ6Pz'.split('')
BASE = BASE_CHARS.length
BASE_ENCODED_MIN_LENGTH = 1
def self.decode(number)
# assure string
number = number.to_s.reverse.split('')
decoded = 0