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 | |
# Works for /16 CIDR Blocks, change / upgrade the script if you need | |
CIDR_PREFIX="172.20" | |
for oct1 in {128..255}; do | |
# Generate a new list of used IPs on every block | |
calicoctl get wep --all-namespaces | awk '{print $4}' |cut -d "/" -f1 > valid_ips.txt | |
for oct2 in {1..254}; do | |
if grep "${CIDR_BLOCK}.$oct1.$oct2" ./valid_ips.txt; 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
function! SelectaCommand(choice_command, selecta_args, vim_command) | |
let dict = { 'buf': bufnr('%'), 'vim_command': a:vim_command, 'temps': { 'result': tempname() }, 'name': 'SelectaCommand' } | |
function! dict.on_exit(id, code) | |
bd! | |
if a:code != 0 | |
return 1 | |
endif |
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
# RAILS_ROOT/lib/tasks/assets.rake | |
namespace :assets do | |
desc 'Precompile assets and upload to S3' | |
task :upload, [:noop] => ['assets:clean', 'assets:precompile'] do |_, args| | |
args.with_defaults(noop: false) | |
Fog.credentials_path = "#{Rails.root}/config/fog_credentials.yml" | |
Dir.chdir("#{Rails.root}/public") do | |
assets = FileList['assets',"assets/**/*"].inject({}) do |hsh, path| |
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
source "http://rubygems.org" | |
gem "railties", '4.0.3', require: %w(action_controller rails) | |
gem "grape" |
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
# config/initializers/instrumentation.rb | |
# Subscribe to grape request and log with Rails.logger | |
ActiveSupport::Notifications.subscribe('grape.request') do |name, starts, ends, notification_id, payload| | |
Rails.logger.info '[API] %s %s (%.3f ms) -> %s %s%s' % [ | |
payload[:request_method], | |
payload[:request_path], | |
(ends-starts)*1000, | |
(payload[:response_status] || "error"), | |
payload[:x_organization] ? "| X-Org: #{payload[:x_organization]}" : "", |
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 | |
# Generic script for running ruby scripts as daemons using | |
# jsvc and a java class to control the daemon. | |
# | |
# Contains common parameters and start/stop | |
# Things you'll need to set on a per script/daemon basis: | |
# SCRIPT_NAME | |
# | |
# Things you can set: |
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 Morpheus | |
module Adapters | |
module Solr | |
class Relation | |
include ActiveModel::Model | |
attr_accessor :connection, :relation_class, :where | |
delegate :present?, :blank?, :empty?, to: :to_a | |
delegate :each, :map, :collect, :select, :find, :last, :first, to: :to_a | |
delegate :total, :facet_fields, to: :response |
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
--colour | |
-I app |
NewerOlder