Skip to content

Instantly share code, notes, and snippets.

View gilr00y's full-sized avatar
🚀

Jason Gilbertson gilr00y

🚀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gilr00y on github.
  • I am gilr00y (https://keybase.io/gilr00y) on keybase.
  • I have a public key whose fingerprint is D442 C2E5 DEAE 7FC3 C8EA 3986 7FB1 8581 D81E EF35

To claim this, I am signing this object:

@gilr00y
gilr00y / gist:cff872322a6b984058b0
Created June 24, 2014 11:57
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised,
# returning result of block if no errors.
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
AR = ActiveRecord::Base
AR.transaction { 14 } #=> 14
# Errors are propagated...
AR.transaction { raise } #=> RuntimeError
@gilr00y
gilr00y / gist:d32b6cff4968a55a37da
Created June 24, 2014 11:57
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised,
# returning result of block if no errors.
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
AR = ActiveRecord::Base
AR.transaction { 14 } #=> 14
# Errors are propagated...
AR.transaction { raise } #=> RuntimeError
@gilr00y
gilr00y / gist:e7bb64cf2deecb26031e
Created June 24, 2014 11:57
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised,
# returning result of block if no errors.
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
AR = ActiveRecord::Base
AR.transaction { 14 } #=> 14
# Errors are propagated...
AR.transaction { raise } #=> RuntimeError
@gilr00y
gilr00y / gist:bb15ef30be9a6656d4ef
Created June 24, 2014 11:57
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised,
# returning result of block if no errors.
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
AR = ActiveRecord::Base
AR.transaction { 14 } #=> 14
# Errors are propagated...
AR.transaction { raise } #=> RuntimeError
@gilr00y
gilr00y / gist:bce2dbba5b7329b2ef94
Created June 24, 2014 11:57
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised,
# returning result of block if no errors.
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
AR = ActiveRecord::Base
AR.transaction { 14 } #=> 14
# Errors are propagated...
AR.transaction { raise } #=> RuntimeError
@gilr00y
gilr00y / gist:70f2d0ac43049cba059f
Last active August 29, 2015 14:02
ActiveRecord Cross-DB transactions
# AR transactions wrap a block of code, issuing a rollback if any errors are raised.
#
#(note: this gist makes use of SecondBase https://github.com/customink/secondbase)
require 'secondbase/model'
AR = ActiveRecord::Base
SB = SecondBase::Base
# The transaction returns the return value of the block
AR.transaction { 14 } #=> 14
@gilr00y
gilr00y / windower.py
Created August 1, 2019 16:59
Torch - Sliding Window transform for Object Detection
import numpy as np
import torch
class WindowUtils:
@staticmethod
def is_overlapping(window, annot):
crop_tolerance = 0.25
win_min_x, win_min_y, win_max_x, win_max_y = window
ann_min_x, ann_min_y, ann_max_x, ann_max_y, cat = annot