Skip to content

Instantly share code, notes, and snippets.

@bion
bion / 01_classes_and_interfaces.java
Last active January 27, 2021 00:00
Domain model design sketch -- ObjectMapper approach
@Entity
class Applicant extends Model {
@Id
Long id;
@DbJsonB
=ERROR REPORT==== 11-Apr-2020::14:43:18.391012 ===
Error in process <0.87.0> with exit value:
{internal_error,
[{re,internal_run,
[<<"\n$time $metadata[$level] $levelpad$message\n">>,
{re_pattern,2,0,0,
<<69,82,67,80,137,0,0,0,0,0,0,0,65,0,0,0,255,255,255,255,255,
255,255,255,0,0,36,0,0,0,2,0,0,0,64,0,7,0,2,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,104,101,97,100,0,0,2,116,
97,105,108,0,125,0,55,127,0,5,0,1,114,0,5,29,36,106,0,0,0,0,0,
@bion
bion / pair-participants.rb
Last active April 1, 2020 18:05
remote tea pairing
#!/usr/bin/ruby
require 'json'
require 'set'
$/ = "END"
puts "paste in the emails, one per line, and then END on its own line:"
emails_input = STDIN.gets
ldap_list = emails_input
@bion
bion / webpage_counting_solution.rb
Last active November 14, 2019 06:35
Webpage counting interview question
require 'set'
Page = Struct.new(:url) do
LINK_TABLE = {
"google.com" => %w[google.com/maps google.com/mail],
"google.com/mail" => %w[google.com google.com/mail/drafts google.com/mail/spam],
"google.com/mail/drafts" => %w[google.com google.com/mail google.com/mail/spam],
"google.com/mail/spam" => %w[google.com google.com/mail google.com/mail/drafts],
"google.com/maps" => %w[google.com google.com/my-maps google.com/mail],
"google.com/my-maps" => %w[google.com google.com/maps]
@bion
bion / 01_loops_review.rb
Last active September 12, 2019 03:37
Methods, loops, and class instance review and exercises
# Loops take a piece of code and execute it
# zero to many times depending on the loop, depending on the loop conditions
# The code between `do` and `end` defines the body of the loop, which is the
# code that will be executed for each iteration of the loop
# The words in between the | characters are the parameter list for the loop
# A common loop in ruby is the `each` loop. `each` executes its loop body once
# for each item in an array or hash. On each executation it passes the next
@bion
bion / salaries.json
Last active October 24, 2018 02:05
2018 MLS Player salaries
[
{
"firstName": "Adrian",
"lastName": "Zendejas",
"club": "Sporting Kansas City",
"position": "GK",
"base": "$55,650.00",
"total": "$55,650.00"
},
{
@bion
bion / id_rsa.pub
Created October 9, 2017 17:23
bion's substantial RSA public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDpeEHYcEKCbso5K1hQ8FXBJf/i/3msgQp7w5ytvcb7HLsbaC1ZPzUIFIWAoMiB/nIGjka+/qPznLxv48TpV36sax6PspFjFu6nC33NstIonBMhYzYedbbeADmcXLjBQNmkc56vsRxht+Fbcex1zByx3rrOSfU2HsXHU0X7ny9FOi/9hvmirWZy75GaTbSoBx6ZcsT/lrewrikT+Xt/NEX5S+O3jaVeUcXjYkMGc7XeTQiBj3MplKHUZVhRdeuAs9Ii2RlW7h+BahQZwuix/tDVGh2ni3ixWoyEPvHIL5HP1MGBjM1NlF3z+psraxNhCgANqPNp2gVfgzOEVC9cK5d/Xu2+YoY4uHhzaY3c/zWlhSI+1C0eAR3J+EVJEC7dnImcJr4uKcNs+NgDAWUUjDHFCo3f6MDJqfnYN5WfG2PSOcrebx722I6DxCj+hqe2LaLuULzsgO7W4W3zPLrVUnFc0YG334MCaQ4ytdVwmwzJNVj/4hjW9Bbdl0LBFi4HbvwEgl5aitPD9cVG101/f1HN6zMk7OjDcNiyWqqajEtI/nO86WPLkBKHAosVlono64LoGPZDU6WG/WrzBQt/QJygVhHEad27r9p5+VMv9LT+lBoCjnKPcp5jN2o1bMzZGP+CuhyuNOBa3roSEIKXgzf61y8t0TLWPFA0RFEFS4Q1LQ== bion@substantial.com
@bion
bion / download-passwords
Last active September 6, 2017 19:33
password game
https://crackstation.net/buy-crackstation-wordlist-password-cracking-dictionary.htm
alias l="ls -l"
alias ll="l"
alias lll="l"
alias llll="l"
alias lllll="l"
alias llllll="l"
alias lllllll="l"
alias llllllll="l"
alias lllllllll="l"
alias llllllllll="l"
@bion
bion / ls-large-files
Created March 18, 2017 01:21
ls-large-files
#!/bin/bash
dir=${1-"."}
number=${2-"10"}
find $dir -type f -print0 |
xargs -0 du -s |
sort -n |
tail -$number |
cut -f2 |