Skip to content

Instantly share code, notes, and snippets.

@grodowski
grodowski / schema_validations_extractor.rake
Last active January 27, 2021 18:37
Codegen script to extract explicit ActiveModel validators from SchemaValidations::ActiveRecord
# frozen_string_literal: true
namespace :validations do
desc 'List all model validations defined by schema_validations'
task list: :environment do
LIST_OUTPUT = STDOUT
VALIDATIONS = Hash.new
# monkey patch SchemaValidations to extract validation metadata instead of applying them
# gem source: lib/schema_validations/active_record/validations.rb
@grodowski
grodowski / semaphore_sample.yml
Created June 25, 2020 19:43
Semaphore + UndercoverCI
- name: Unit Tests
task:
jobs:
- name: RSpec
commands:
- checkout
- cache restore
- sem-version ruby 2.6.0
- bundle install --deployment --path vendor/bundle
- bundle exec rspec
@grodowski
grodowski / README.md
Last active December 18, 2019 09:40
Home Automation for Bose Soundtouch

Installation

  • install dependencies
  • sudo cp dj.service /etc/systemd/system/
  • sudo systemctl enable dj.service
  • sudo journalctl -fu dj.service

Features

  • alarm clock
  • automatic zone creation
@grodowski
grodowski / merge_coverage.rb
Last active September 26, 2022 04:28
Merge coverage reports from parallel circle test containers
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'simplecov'
require 'simplecov-lcov'
puts('Merging coverage results from parallel CircleCI tests containers into a single LCOV report...')
results = []
Dir['/home/circleci/rspec/*.resultset.json'].each do |path|
@grodowski
grodowski / keybase.md
Created October 17, 2017 16:27
keybase.md

Keybase proof

I hereby claim:

  • I am grodowski on github.
  • I am mrgrodo (https://keybase.io/mrgrodo) on keybase.
  • I have a public key whose fingerprint is C17C 6E1A D19F E669 0FA5 64D5 05A5 75A2 AEF0 8488

To claim this, I am signing this object:

@grodowski
grodowski / Preferences.sublime-settings
Created September 20, 2017 08:43
SublimeText 3 config
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
"theme": "Default.sublime-theme",
@grodowski
grodowski / minio_test.go
Last active June 23, 2017 10:21
Minio upload empty byte array
package main
import (
"bytes"
"fmt"
"log"
"github.com/grodowski/minio-go"
)
@grodowski
grodowski / run_ci.sh
Created January 31, 2017 14:11
Golang - recursive tests + coverage
#!/bin/bash
shopt -s globstar
rootdir=`pwd`
for dir in **/ ; do
cd $dir
exec 5>&1
out=$(go test -v -coverprofile=cov_part.out | tee >(cat - >&5))
if [ $? -eq 1 ] ; then
if [ $(cat $out | grep -o 'no buildable Go source files') == "" ] ; then
@grodowski
grodowski / script.sh
Created January 10, 2017 11:12
Set "View as icon" option as default in Apple Mail
#!/bin/bash
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
@grodowski
grodowski / .bash_profile
Created November 27, 2016 15:06
Dotfiles
# Some colors
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
# Dev shortcuts
alias be="bundle exec"
alias dkc='docker-compose'
alias dkcr='docker-compose run'
alias dkr='docker run'