Skip to content

Instantly share code, notes, and snippets.

View bhgomes's full-sized avatar
☀️
solar-powered

Brandon H. Gomes bhgomes

☀️
solar-powered
View GitHub Profile
@bhgomes
bhgomes / util_iter.rs
Created April 24, 2021 20:32
Rust Iteration Utilities
use core::fmt;
/// Folds an iterator with a spacer.
pub fn fold_iter_with_spacer<I, F, S, T, E>(
iter: I,
init: T,
mut f: F,
mut spacer: S,
) -> Option<Result<T, E>>
where
@bhgomes
bhgomes / README.md
Created February 6, 2021 03:45 — forked from quagliero/README.md
Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

This assumes you have brew installed and are comfortable using a terminal.

Following the guide on https://github.com/tpruvot/cpuminer-multi will likely lead to errors about invalid paths to OpenSSL, and neoscrypt errors to the tune of Undefined symbols for architecture x86_64 during the build. I managed to piece together different fixes into an installation that has worked for me. So I hope it works for you.

Requirements

Ensure a c compiler is installed. Type g++ in the terminal and continue with the xcode installation if necessary. If it prints clang: error: no input files, then you can proceed.

@bhgomes
bhgomes / lean-abbreviations.json
Created January 28, 2021 20:36
Lean Abbreviations
{
"{}": "{$CURSOR}",
"{}_": "{$CURSOR}_",
"{{}}": "⦃$CURSOR⦄",
"[]": "[$CURSOR]",
"[]_": "[$CURSOR]_",
"[[]]": "⟦$CURSOR⟧",
"<>": "⟨$CURSOR⟩",
"()": "($CURSOR)",
"()_": "($CURSOR)_",
@bhgomes
bhgomes / FUNDING.yml
Last active October 17, 2020 17:59
Sponsor File
# FUNDING.yml
# Brandon H. Gomes
github: bhgomes
patreon: bhgomes
ko_fi: bhgomes
liberapay: bhgomes
issuehunt: bhgomes
@bhgomes
bhgomes / counting_experiment.jl
Created October 17, 2020 17:48
Signal/Background Counting Experiment in Turing.jl
using Turing
using Distributions
using StatsPlots
using StatsBase
using Random
# Setup Turing
Turing.turnprogress(false)
Turing.setadbackend(:forward_diff)
@bhgomes
bhgomes / formula_cookbook.md
Created July 26, 2016 03:06
Formula Cookbook for Homebrew

Formula Cookbook

A formula is a package definition written in Ruby. It can be created with brew create $URL, installed with brew install $FORMULA, and debugged with brew install --debug --verbose $FORMULA. Formulae use the Formula API which provides various Homebrew-specific helpers.

Homebrew Terminology

Term Description Example
Formula The package definition /usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb
Keg The installation prefix of a Formula /usr/local/Cellar/foo/0.1
opt prefix A symlink to the active version of a **
@bhgomes
bhgomes / MakeDatabase.java
Last active October 11, 2020 04:04
JAQL Snippet Example 1: Creating a Database
import bhgomes.jaql.*;
public class MakeDatabase {
public static void main(String[] args) {
// Method 1
Database db1 = JAQL.open("db1", JAQL.SQLITE_DRIVER, "jdbc:sqlite:db1.db");
db1.info("Built a Database with JAQL convenience class");
// Method 2
Database db2 = new Database("db2").open(JAQL.SQLITE_DRIVER, "jdbc:sqlite:db1.db");
@bhgomes
bhgomes / setup.py
Created January 16, 2019 17:06
Sample setup.py that reads from setup.json
# -*- coding: utf-8 -*-
#
# setup.py
#
SETUP_JSON = 'setup.json'
import io
import json
import os
@bhgomes
bhgomes / bounded.py
Created January 18, 2019 05:07
Bounded Object Wrapper
from wrapt import ObjectProxy
class Bounded(ObjectProxy):
"""
Bounded Object Proxy.
"""
def __init__(self, wrapped, *, minimum=None, maximum=None):
"""Initialized Wrapped Bounded Object."""
@bhgomes
bhgomes / .travis.yml
Created March 11, 2019 13:56
Conda Travis CI
sudo: false
language: python
dist: xenial
matrix:
include:
- python: 3.3
- python: 3.4
- python: 3.5
- python: 3.6