Skip to content

Instantly share code, notes, and snippets.

View Mongey's full-sized avatar

Conor Mongey Mongey

View GitHub Profile
@Mongey
Mongey / machine.js
Created March 13, 2020 16:31
Generated by XState Viz: https://xstate.js.org/viz
const applicationMachine = Machine({
id: 'application',
initial: 'Unlocked',
states: {
Unlocked: {
on: { Confirmed: 'Decision'},
},
Decision: {
on: {
No: 'Rejected',
hello
world
(def set-schema-registry-haproxy-events-to-critical
(where (and (service schema-registry-500-error-service-name)
(not= metric nil)
(>= metric schema-registry-500-error-threshold)
(state "ok"))
(with :state "critical" reinject)))
#!/bin/bash
#
# reload haproxy, but avoid losing existing connections
#
# briefly reject connection (SYN) TCP packets during port switch, so that
# connections are retried
#
# see:
# https://medium.com/@Drew_Stokes/actual-zero-downtime-with-haproxy-18318578fde6
# http://engineeringblog.yelp.com/2015/04/true-zero-downtime-haproxy-reloads.html
@Mongey
Mongey / 0_reuse_code.js
Created October 3, 2013 20:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
require 'RMagick'
include Magick
width = 90
height = 100
matrix = [
[0,1,0,0,0],
[0,1,0,0,0],
[0,0,1,0,0],
[0,1,0,0,0],
[0,1,0,0,0],
@Mongey
Mongey / fetch.rb
Created October 20, 2012 16:49
CS3071 Compiler Upload / Compile Script
#!/usr/bin/env ruby
# ______ _ _
# | ___ \ (_) |
# | |_/ /_ __ ___ _ __ _| | ___ _ __
# | ___ \ '__/ _ \| '_ \| | |/ _ \ '__|
# | |_/ / | | (_) | |_) | | | __/ |
# \____/|_| \___/| .__/|_|_|\___|_|
# | |
# |_|
require 'net/scp'
class Employee < ActiveRecord::Base
has_many :timeslots
scope :free_time, lambda {|day| joins(:timeslots).merge(Timeslot.on(day)) }
end
promptList (x:[]) partial = do
putStrLn ("Enter value for " ++ x)
input<-getLine
(partial ++ [input])
promptList (x:xs) partial = do
putStrLn ("Enter value for " ++ x)
input<-getLine
promptList xs (partial ++ [input])
public class Message{
public String recipient, sender,body;
public Message(String recipient, String sender,String body){
this.recipient=recipient;
this.sender=sender;
this.body = body;
}
public void append(String text){
this.body = this.body + text;