Skip to content

Instantly share code, notes, and snippets.

View mjc-gh's full-sized avatar
🎯
Open Sourcing

Michael Coyne mjc-gh

🎯
Open Sourcing
View GitHub Profile
@mjc-gh
mjc-gh / docker-compose.yml
Last active February 28, 2023 16:48 — forked from nicoavila/docker-compose.yml
Docker Compose file for a MySQL 5.7 container
version: '3.3'
services:
database:
image: mysql:5.7
container_name: mysql
restart: always
environment:
MYSQL_DATABASE: 'ThriveFantasy'
MYSQL_USER: 'tf'
MYSQL_PASSWORD: 'password'
<a href="https://www.publicist.co/app/login/" style="line-height: 24px; text-decoration: none; word-break: break-word; font-weight: 500; display: block; font-family: 'Poppins', Helvetica, Arial, sans-serif; font-size: 16px; color: #ffffff" class="intercom-h2b-button">Login to Publicist</a>
@mjc-gh
mjc-gh / test_helper.rb
Last active June 13, 2020 16:14
Minitest methods
require 'minitest/autorun'
class Minitest::Test
def self.test(name, &block)
define_method "test_#{name.gsub(/\s+/, '_')}", &block
end
def self.setup(&block)
define_method :setup, &block
end
#!/usr/bin/env python
import itertools, copy
HOUSE_VALUE = {
'stark': 42,
'greyjoy': 20,
'martel': 25,
'baratheon': 40,
'lannister': 35,
'tyrell': 28
date visitor_id
2018-01-15 pFihzA
2018-01-15 6N2dMg
2018-01-15 P4rCVA
2018-01-15 RE3k5A
2018-01-15 sATrOg
2018-01-15 hz-j3A
2018-01-15 kVP6CQ
2018-01-15 upEtnw
2018-01-15 8uur7A
@mjc-gh
mjc-gh / deck.rb
Created September 27, 2018 04:02
Deck of Cards
class Card < Struct.new(:rank, :suit)
def inspect
"#{rank} of #{suit}s"
end
end
##
# Problem #1 -- create a deck of cards and shuffle it
##
require 'active_support/multibyte/chars'
require 'active_support/core_ext/string/inflections'
require 'json'
require 'httpi'
require 'nokogiri'
STG_CONTROL_FILE = '.last-date'.freeze
STG_CHANNEL_URL = 'https://hooks.slack.com/services/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'.freeze
STG_SKIPPED_MENUS = %w(Pastries Breakfast).freeze
ssh -L 3000:localhost:3000 -L 3001:localhost:3001 -L 3002:localhost:3002 -L 8000:localhost:8000 -L 35729:localhost:35729
require 'openssl'
def hkdf(digest_klass, length, ikm, salt, info)
prk = OpenSSL::HMAC.digest(digest_klass.new, salt, ikm)
okm, t = '', ''
(length.to_f / digest_klass.new.length).ceil.times do |index|
t = OpenSSL::HMAC.digest(digest_klass.new, prk, "#{t}#{info}#{(index + 1).chr}")
okm << t
end
class MessageVerifierTest < ActiveSupport::TestCase
def test_null_serializer
verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", serializer: ActiveSupport::MessageEncryptor::NullSerializer)
message = verifier.generate("message", expires_in: 1.day, purpose: 'NullSerializer')
assert_equal "message", verifier.verify(message)
end
end