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 -exu | |
| dev=$1 | |
| cd $(mktemp -d) | |
| function umountboot { | |
| umount boot || true | |
| umount root || true | |
| } | |
| # RPi1/Zero (armv6h): |
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
| module System | |
| extend self | |
| def cpu_count | |
| return Java::Java.lang.Runtime.getRuntime.availableProcessors if defined? Java::Java | |
| return File.read('/proc/cpuinfo').scan(/^processor\s*:/).size if File.exist? '/proc/cpuinfo' | |
| require 'win32ole' | |
| WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors | |
| rescue LoadError | |
| Integer `sysctl -n hw.ncpu 2>/dev/null` rescue 1 | |
| end |
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
| Function::define = (prop, desc) -> | |
| Object.defineProperty this.prototype, prop, desc | |
| class GetterSetterTest | |
| constructor: (@_obj = {}) -> | |
| # 'obj' is defined via the prototype, the definition proxied through | |
| # to 'Object.defineProperty' via a function called 'define' providing | |
| # some nice syntactic sugar. Remember, the value of '@' is | |
| # GetterSetterTest itself when used in the body of it's class definition. |
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 'rubygems' | |
| require 'benchmark' | |
| require 'rulebook' | |
| class Foo | |
| [:admin, :blah].each do |role| | |
| define_method "is_#{role}?" do | |
| true | |
| end |