Skip to content

Instantly share code, notes, and snippets.

View fnichol's full-sized avatar

Fletcher Nichol fnichol

View GitHub Profile
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@fnichol
fnichol / smartos-virtio-windows-xp.sh
Created November 17, 2012 18:37
SmartOS: Installing Windows XP With virtio Disk Support
#!/usr/bin/env bash
set -e
if [ -z "$iso" ] ; then
printf -- ">>> You must invoke with iso=/path/to/winxp.iso $(basename $0)\n"
exit 1
fi
if [ -z "$url" ] ; then
@fnichol
fnichol / maven_install.sh
Created November 17, 2010 19:26
Apache Maven Installer
#!/usr/bin/env bash
# ## Installing Apache Maven
#
# bash < <(curl -L http://gist.github.com/raw/703892/maven_install.sh)
#
mavens=( 2.2.1 3.0.1 )
current="3.0.1"
@fnichol
fnichol / README.md
Last active April 27, 2023 15:24
Auto-enable Local HTTP Caching in Test Kitchen

Auto-enable Local HTTP Caching in Test Kitchen

Note: total experiment and hack, looks nasty, could be awesome:

Setup

  • Drop the kitchen.local.yml into $HOME/.kitchen/config.yml
  • Install polipo (with Mac: brew install polipo, with Ubuntu: apt-get install polipo)
  • Drop polipo-start and polipo-console somewhere useful (perhaps $HOME/bin?)
@fnichol
fnichol / README.md
Last active August 6, 2022 20:29
Testing on Mac Platforms with Test Kitchen

Testing Mac Platforms with Test Kitchen

We'll assume an OS X Mavericks (10.9) box here.

Requirements

You'll need:

  • Vagrant
  • Vagrant's VMware Fusion provider
@fnichol
fnichol / macosx_bootstrap.sh
Last active January 31, 2022 21:09
Mac OS X 10.7/10.8/10.9 (Lion/Mountain Lion/Mavericks) Bootstrapping
#!/usr/bin/env bash
set -e
# # Mac OS X 10.7/10.8/10.9/10.10 Bootstrapping
#
# ## Pre-requisites
#
# 1. Set your hostname: In **System Preferences** go to **Sharing** and enter
# the name in **Computer Name**
# 2. Run **Software Update** and reboot if necessary
@fnichol
fnichol / postinstall.sh
Created September 12, 2012 05:16
Ubuntu Postinstall
#!/usr/bin/env bash
# **postinstall.sh** is a script executed after Debian/Ubuntu has been
# installed and restarted. There is no user interaction so all commands must
# be able to run in a non-interactive mode.
#
# If any package install time questions need to be set, you can use
# `preeseed.cfg` to populate the settings.
#
# To run:
@fnichol
fnichol / Profile.ps1
Created November 10, 2020 08:35
PowerShell Profile loading Visual Studio 2019
# Thanks to: https://gist.github.com/justinian/81a2e55c89e8301a8a96
$tempFile = [IO.Path]::GetTempFileName()
## Store the output of cmd.exe. We also ask cmd.exe to output
## the environment table after the batch file completes
cmd /c " `"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat`" && set > `"$tempFile`" "
## Go through the environment variables in the temp file.
@fnichol
fnichol / README.md
Last active August 17, 2020 14:41
A Windows/Linux/macOS PowerShell Rustup Install Script

A Windows/Linux/macOS PowerShell Rustup Install Script

On Windows, run

& ([scriptblock]::Create((New-Object System.Net.WebClient).DownloadString('https://gist.github.com/fnichol/699d3c2930649a9932f71bab8a315b31/raw/rustup-init.ps1')))

in a PowerShell session. This downloads and runs rustup-init.ps1, which in turn downloads and runs the correct version of the rustup-init executable on