curl https://gist.github.com/raw/970438/caff9a09ed2d223b1123a69ede17cb19ad352af9/build.sh | sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$#" -ne 2 ] ; then | |
| echo 'Usage: mount-nbd.sh <device> <mount_point>' | |
| exit 1 | |
| fi | |
| device=$1 | |
| fs_type=$(blkid -o value -s TYPE $device) | |
| if [[ -z $fs_type ]] ; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install -y usbmount | |
| sudo bash -c "cat <<EOT > /etc/usbmount/mount.d/01_create_label_symlink | |
| #!/bin/sh | |
| # This script creates the volume label symlink in /var/run/usbmount. | |
| # Copyright (C) 2014 Oliver Sauder | |
| # | |
| # This file is free software; the copyright holder gives unlimited | |
| # permission to copy and/or distribute it, with or without | |
| # modifications, as long as this notice is preserved. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| paste this code into a playground to test it out | |
| */ | |
| import Foundation | |
| /** | |
#Mac OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # for some reason facter takes the raw memorysize and reports it as | |
| # a formatted string, which is useless for calculation | |
| # | |
| Facter.add("memorysize_raw") do | |
| confine :kernel => :linux | |
| setcode do | |
| size = 0 | |
| File.readlines("/proc/meminfo").each do |l| | |
| size = $1.to_f if l =~ /^MemTotal:\s+(\d+)/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Git push then pull over ssh | |
| # | |
| # Supposing you have these environments on the same ssh git remote: | |
| # project/origin.git | |
| # project/dev/.git | |
| # project/prod/.git | |
| # | |
| # You can then push the current branch and pull it in dev/ and prod/ by doing: | |
| # $ git deploy dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'capistrano/version' | |
| load 'deploy' | |
| # Customize the following variables | |
| set :domain, "host.example.com" | |
| set :user, "username" | |
| set :application, "my_wordpress_blog" | |
| set :deploy_to, "/var/www/apps/#{application}" | |
| # These variables probably don't need to change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra_app' | |
| require 'test/unit' | |
| require 'rack/test' | |
| set :environment, :test | |
| class SinatraAppTest < Test::Unit::TestCase | |
| include Rack::Test::Methods | |
| # Make all tests transactional. |