Skip to content

Instantly share code, notes, and snippets.

View brennovich's full-sized avatar
👋
Hey, there

Brenno Costa brennovich

👋
Hey, there
View GitHub Profile
@brennovich
brennovich / release_ips.sh
Created April 19, 2019 20:13 — forked from phspagiari/release_ips.sh
Release Calico unused IPs from CIDR Block (Bug v3.3.x)
#!/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
@brennovich
brennovich / README.markdown
Created February 12, 2016 00:44 — forked from terlar/README.markdown
ArchLinux on Mac Book Retina 13"
@brennovich
brennovich / selecta_command.vim
Last active November 29, 2016 14:44 — forked from drewdeponte/selecta_command.vim
An attempt at implementing support for selecta in neovim
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
@brennovich
brennovich / assets.rake
Created October 20, 2015 13:41 — forked from jparker/assets.rake
Rake task for compiling assets and uploading them to S3
# 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|
@brennovich
brennovich / Gemfile
Last active August 29, 2015 14:26 — forked from teamon/Gemfile
Mount Grape API at rails root
source "http://rubygems.org"
gem "railties", '4.0.3', require: %w(action_controller rails)
gem "grape"
# 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]}" : "",
#! /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:
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
@brennovich
brennovich / .rspec
Created November 29, 2013 00:24 — forked from coreyhaines/.rspec
--colour
-I app

TODO: make gem for this

This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.

Bower

  1. Set the install directory for Bower components:

// .bowerrc