Skip to content

Instantly share code, notes, and snippets.

View RedFred7's full-sized avatar

Fred Heath RedFred7

View GitHub Profile
@iboard
iboard / fizz_buz.rb
Last active January 20, 2019 07:57
Benchmarking if versus map-matching (a kind of pattern-matching in ruby)
require "benchmark"
def log msg
# NOOP
end
def with_if(x)
x.times do |n|
if (n % 3 == 0) && (n % 5 != 0)
log 'Fizz'
#!/usr/bin/env ruby
require 'json'
USAGE = "USAGE:\ngit ticket TICKET_ID\n"
# get ticket ID from first command line argument
ticket_id = ARGV[0]
unless ticket_id
print USAGE
@keithrbennett
keithrbennett / push-all
Last active July 30, 2018 08:36
Ruby script that pushes current branch to all remote repos in parallel.
#!/usr/bin/env ruby
#
# push_all Pushes commits and tags for the active branch to all remote repos.
#
BRANCH = `git rev-parse --abbrev-ref HEAD`.chomp
REMOTES = `git remote -v`.split("\n").map { |line| line.split.first}.sort.uniq
Result = Struct.new(:remote, :exit_code, :output)
@dabit3
dabit3 / App.js
Last active November 16, 2022 05:46
Persisting a keypair for reading across clients
/*
* this file includes both a node.js script for creating a keypair
* as well as the client code for using it
*/
/* createKeypair.js */
const fs = require('fs')
const anchor = require("@project-serum/anchor");
const web3 = require('@solana/web3.js')
const account = anchor.web3.Keypair.generate();