This file contains 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 | |
set -eo pipefail | |
set -x | |
error1() { | |
echo "exit whole script!!!" | |
exit 1 | |
} | |
SCRIPT_PATH="$(cd "$(dirname "$0")"; pwd -P)" |
This file contains 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 | |
TIMEOUT=${HEALTH_CHECK_TIMEOUT:-30} | |
URL=${HEALTH_CHECK_URL:-localhost:8091/health} | |
RESPONSE=$(curl --connect-time $TIMEOUT --max-time $TIMEOUT -qs "$URL") | |
OUTCOME=$? | |
set -e | |
if [ ${OUTCOME} -eq 7 ]; then | |
echo "Failed to connect to ${URL}, cURL returned status ${OUTCOME}. Cheetah may not be started fully yet." | |
exit $OUTCOME | |
fi |
This file contains 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 [ -z "$RMQ_USERNAME" ]; then | |
echo "Error:RMQ_USERNAME was not set." | |
exit 1 | |
fi | |
if [ -z "$RMQ_PASSWORD" ]; then | |
echo "Error:RMQ_PASSWORD was not set." | |
exit 1 | |
fi |
This file contains 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 node in $(curl -s -u user:pass http://localhost:15672/api/nodes | jq '.[]' | jq -r '.name'); do echo $node; curl -s -u user:pass http://localhost:15672/api/queues | jq --arg NODE "$node" '.[] | select(.node | contains($NODE)) | .name ' | wc -l ; done | |
# OUTPT: | |
# rabbit@6f419d949cc1049ab273a09da19259fd | |
# 94 | |
# rabbit@b164f368cc1ad8f64b54794f5fec955e | |
# 381 | |
# rabbit@c5e18a7747eb7fbdd4f53b4b756557f2 | |
# 9 |
This file contains 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
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/streadway/amqp" | |
) | |
func failOnError(err error, msg string) { |
This file contains 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
define(function() { | |
'use strict'; | |
return { | |
load: function() { | |
var key = "KEYHERE"; | |
window._errs = [key]; | |
var c = window.onerror; | |
window.onerror = function() { | |
var a = arguments; | |
window._errs.push(a); |
This file contains 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 'matrix' | |
def spiral(height, width, start_row, start_col) | |
@results = [] | |
i = 0 | |
m = Matrix.build(height, width) do |row, col| | |
i+=1 | |
end | |
start_row = x = start_row-1 | |
start_col = y = start_col -1 | |
distance = 1 |
This file contains 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
The bug is related to the discrete graphics card. | |
Specifically, chrome by default forces osx always to use the discrete graphics card. You can see this by using the tool GfxCardStatus. | |
Anwyays, to solve this, start chrome from the command line using a flag to force it to use the integrated card. | |
open -a /Applications/Google\ Chrome.app/ --args --gpu-switching=force_integrated |
This file contains 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
class ResourcesController < ApplicationController | |
def create | |
@resource = Resource.new(params[:resource]) | |
respond_to do |format| | |
if @resource.save | |
format.html { redirect_to @resource.skill, notice: 'Resource was successfully created.' } | |
else | |
format.html { render @resource.skill } | |
end |
This file contains 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
if Rails.env.development? | |
LOG.sev_threshold = LOGGER::DEBUG | |
else | |
LOG.sev_threshold = LOGGER::INFO | |
NewerOlder