Skip to content

Instantly share code, notes, and snippets.

@israelb
israelb / rubocop_pre_commit_hook
Created October 25, 2018 14:02 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED
@israelb
israelb / openssl.sh
Created September 7, 2018 15:40
openssl
openssl req -nodes -newkey rsa:2048 -keyout yourdomain.key -out yourdomain.csr
@israelb
israelb / who_is_my_mummy.sh
Created August 24, 2018 18:09 — forked from joechrysler/who_is_my_mummy.sh
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@israelb
israelb / capybara
Created August 15, 2018 15:59
capybara problems
brew upgrade [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
bundle intall
https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#homebrew
Problem:
Fetching nokogiri 1.8.4
@israelb
israelb / nginx01_api.conf
Last active July 23, 2018 14:51
nginx.conf Front end prod.
user www-data;
worker_processes 4;
pid /run/nginx.pid;
worker_rlimit_nofile 30000;
events {
worker_connections 8192;
# multi_accept on;
}
@israelb
israelb / dynamo_db_query_example.md
Created June 19, 2018 21:27 — forked from kenoir/dynamo_db_query_example.md
Prettied up some AWS Ruby SDK DynamoDB examples from @Integralist.

AWS query-instance_method docs

export AWS_ACCESS_KEY_ID=‘XXXX’
export AWS_SECRET_ACCESS_KEY=‘XXXX’
# ENV['AWS_ACCESS_KEY_ID']
# ENV['AWS_SECRET_ACCESS_KEY']
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
################################################################################
############################# Monit control file #############################
################################################################################
##
#
# Comments begin with a '#' and extend through the end of the line. Keywords
# are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
#
@israelb
israelb / createtable.js
Created February 20, 2018 23:49
dynamo localmente
// create table
var params = {
TableName: 'Report',
KeySchema: [
{
AttributeName: 'UserID',
KeyType: 'HASH',
},
],
AttributeDefinitions: [
@israelb
israelb / main.go
Created February 16, 2018 19:22 — forked from Tamal/main.go
Connect local dynamodb using Golang
package main
import (
"log"
"net/http"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
)