Skip to content

Instantly share code, notes, and snippets.

View sci-phi's full-sized avatar
🤖
You will be upgraded!

Phi.Sanders sci-phi

🤖
You will be upgraded!
View GitHub Profile
@sci-phi
sci-phi / README
Last active April 6, 2022 19:14 — forked from chockenberry/README
A simple AppleScript to start up a web server in the folder where the script is located.
1) Add this code to a new file in Script Editor
2) Export the script as "Application" and make sure it's code signed
3) Put "Startup.app" in the root folder of the test website (e.g. where index.html is located)
4) Make sure that "Startup.app" has Full Disk Access in System Preferences > Security & Privacy > Privacy
@sci-phi
sci-phi / ImageMagick 6.9.7-10 Homebrew Formula.md
Last active February 6, 2018 18:59 — forked from yvbeek/ImageMagick 6.9.7-8 Homebrew Formula.md
Homebrew Formula for ImageMagick 6.9.7-10

Homebrew Formula patching old ImageMagick release 6.9.7-10

Install

brew install https://gist.githubusercontent.com/sci-phi/4c543e355e6ebcdb50aeca08e26b2705/raw/99910a7a84d524d218dced17b5b1eb4a4d7633b0/imagemagick.rb

Pin this version

To prevent upgrades you can pin this version.

@sci-phi
sci-phi / 01-README.md
Created February 22, 2017 22:22 — forked from ryanschwartz/k8 is great.md
k8.bash

kubeenv for lazy typers...

Usage

  1. Copy the below into your .bash_profile or similar
  2. k8 <your-context>, where your-context is the shortcut name you'd like to use
  3. gcloud container clusters get-credentials <clustername>
  4. Repeat step 3 for each of the k8s contexts you want to have available
  5. To use, run k8 <your-context> to change contexts.
server 'app1.reservoir.dogs', :app, {
:user => 'nerd1',
:ssh_options => {
:keys => './keys/nerd.pem'
}
}
server 'app2.reservoir.dogs', :app {
:user => 'nerd2',
:ssh_options => {
@sci-phi
sci-phi / Gemfile
Created December 12, 2012 03:46 — forked from ntalbott/Gemfile
source "https://rubygems.org"
gem "relix"
gem "ruby-progressbar"
@sci-phi
sci-phi / dnsd.rb
Created October 20, 2012 00:44 — forked from peterc/dnsd.rb
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@sci-phi
sci-phi / dantimer.rb
Created June 29, 2012 21:08 — forked from davetron5000/dantimer.rb
DanTimer
#!/usr/bin/ruby
require 'time'
def format_time(seconds)
hours = (seconds / 3600).to_i
minutes = ((seconds % 3600) / 60).to_i
seconds = (seconds % 60).to_i
minutes = "0#{minutes}" if minutes < 10
seconds = "0#{seconds}" if seconds < 10
@sci-phi
sci-phi / article_fetcher.rb
Created June 22, 2012 20:24 — forked from harrisj/article_fetcher.rb
Basic code for the nytimes_ebooks
# encoding: UTF-8
require 'rubygems'
require 'rest-client'
require 'nokogiri'
class ArticleFetcher
def self.fetch_text(url)
case url
when /video\.nytimes\.com/
@sci-phi
sci-phi / deploy.rb
Created July 27, 2011 18:24 — forked from bradly/deploy.rake
Simple Rails Deployments with Net/SSH
require 'net/ssh'
desc "Deploy site to production"
task :deploy => :environment do
host = 'yourhost.com'
user = 'username'
options = {:keys => '~/.ssh/keys/yourserver.pem'}
remote_path = '/path/to/rails_app'
commands = [
@sci-phi
sci-phi / gist:1090477
Created July 18, 2011 19:54 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging