View rescue_var.rb
a = -> { raise "ZOMGERR" }
begin
nom = a.()
rescue => e
nom # => nil
e # => #<RuntimeError: ZOMGERR>
end
View gist:73f794a8f40d41cfa0a64f2ca25d33e5
#10HoursBlissfulSleep
#10yearsago
#21stC
#24frames
#25InNov
#38degrees
#3confessions
#4sq
#4th
#4yearsago
View config.json.erb
<%-
# Here be hax - we find all values that are integers masked as strings and
# turn them into actual integers. Thanks puppet.
numerify = lambda do |obj|
case obj
when lambda { |o| o.respond_to?(:to_i) && o.to_i.to_s == o.to_s }
begin
Integer(obj)
rescue ArgumentError
obj
View .overcommit.yml
PreCommit:
PuppetValidate:
enabled: true
description: 'Validates puppet syntax'
include: '**/*.pp'
View gist:54b062dcfdfe4647db8e9468726742db
repos=(
binder
mahi
manatee
manta
mdata-client
moray
mountain-gorilla
node-sdc-clients
node-smartdc-auth
View rdns.php
<?php
// Looks up the IP address accessing us and prints rDNS record
$remote_ip = $_SERVER["REMOTE_ADDR"];
if (strstr($remote_ip, ', ')) {
$ips = explode(', ', $remote_ip);
$remote_ip = $ips[0];
}
View puppetd_branch
#!/usr/bin/env bash
# Find puppet cattle running a specific branch via mco puppetd
#
# USAGE: puppetd_branch BRANCH
#
set -e
declare branch="$1"
View error.txt
[root@headnode (ovh-1) ~]# sdcadm experimental update -y --all -x sapi -x moray -x binder -x manatee
Finding candidate update images for 25 services (manta, adminui, ca, amon, napi,
vm-agent, dhcpd, amonredis, workflow, net-agent, cn-agent, vmapi, ufds, mahi, cloudapi,
imgapi, fwapi, sdc, cnapi, docker, papi, redis, dockerlogger, cns, assets).
Using channel support
Note: There are no "manta" instances. Only the service configuration will be updated.
This update will make the following changes:
download 1 image (193 MiB):
image 33eec75a-85e4-11e6-8c40-977055a06d03
View illumos.sh
-bash-4.3$ cat projects/illumos/illumos.sh
NIGHTLY_OPTIONS="-CimMNnt"; export NIGHTLY_OPTIONS
GATE="joyent_20161116T172759Z"; export GATE
CODEMGR_WS="/home/caius/smartos-live/projects/illumos"; export CODEMGR_WS
MAX_JOBS=8; export MAX_JOBS
maxjobs() {
ncpu=`kstat -p cpu_info:::state | grep -c on-line`
if [[ $(( $ncpu + 2 )) -lt ${MAX_JOBS} ]]; then
expr $ncpu + 2
else
View rubocop_default_args_assignment.rb
# USAGE:
# rubocop -r ./tmp/rubocop_default_args_assignment.rb --only Style/RubocopDefaultArgsAssigmment app/
#
# Finds method definitions like `def my_thing(date = date)` which are circular references in ruby 2.3.1
# Change them to `def my_thing(date = self.date)` to maintain behaviour
#
module RuboCop
module Cop
module Style
# Check if default args are circular assignments