Skip to content

Instantly share code, notes, and snippets.

View obcilion's full-sized avatar

Raymond Gulbrandsen obcilion

  • Oslo
View GitHub Profile
@obcilion
obcilion / .zshrc
Last active December 7, 2023 09:07
Terminal command timer
#Command timer written for zsh on mac.
# Make sure coreutils are installed, as millisecond precision requires gdate
# -- Calculate and format command runtime --
# Initialize the start time
COMMAND_START_TIME=0
# Function to capture start time
preexec() {
COMMAND_START_TIME=$(gdate +%s%3N) # Current time in milliseconds
@obcilion
obcilion / lograge.rb
Created November 14, 2017 09:22
Lograge initializer with params
Rails.application.configure do
config.lograge.base_controller_class = 'ActionController::API'
config.lograge.enabled = true
config.lograge.custom_options = lambda do |event|
data = event.payload[:params]
data.delete :controller
data.delete :action
{ params: data }
end
@obcilion
obcilion / RecursiveRubySyntaxChecker.rb
Last active February 14, 2017 12:48
Recursive ruby syntex check
require "pathname"
require "open3"
def rec_path(path, file= false)
path.children.collect do |child|
if file and child.file?
child
elsif child.directory?
rec_path(child, file) + [child]
end
@obcilion
obcilion / kb.md
Last active October 19, 2017 10:44

Keybase proof

I hereby claim:

  • I am obcilion on github.
  • I am obcilion (https://keybase.io/obcilion) on keybase.
  • I have a public key whose fingerprint is 276A 2A9B 443D 3A75 812B 5CB4 492A 5527 4F5C 1619

To claim this, I am signing this object:

@obcilion
obcilion / conditional_bundler_update.sh
Created April 13, 2016 08:50
Bash script for keeping bundler up to date with the lockfile
set -e
echo "Comparing lockfile and bundler versions..."
lock_version=`grep -ia1 "bundled with" Gemfile.lock | grep -oe '[0-9]\+\.[0-9]\+\.*[0-9]*'`
bund_version=`bundle -v | grep -oe '[0-9]\+\.[0-9]\+\.*[0-9]*'`
lock_major=`echo $lock_version | grep -o '^[0-9]\+'`
bund_major=`echo $bund_version | grep -o '^[0-9]\+'`
do_update=false