Navigation Menu

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 / 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 / line_reader.py
Last active June 27, 2020 06:09
Line Reader
class LineReader:
"""
Read a static file with smart line access.
WARNING: This implementation assumes that the file does not change between
calls of the `clear` function and never checks for valid file handlers.
"""
def __init__(self, file_handle=None, cache=None, offsets=None):
"""Initialize the LineReader."""
@bhgomes
bhgomes / keybase.md
Created October 29, 2019 16:54
Keybase Verification

Keybase proof

I hereby claim:

  • I am bhgomes on github.
  • I am bhgomes (https://keybase.io/bhgomes) on keybase.
  • I have a public key whose fingerprint is 7FBB 5AE3 B289 9EFC D644 72C2 3A75 F95C 4B85 7834

To claim this, I am signing this object:

@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 / try_import.py
Created April 12, 2019 17:24
Try Import
from importlib import import_module
def try_import(
name, package=None, *exceptions, log_error=passf, log_success=passf, default=None
):
"""
Attempt Package Import With Automatic Exception Handling.
:param name:
:param package:
@bhgomes
bhgomes / box_object.py
Last active October 11, 2020 04:03
Box Object
from wrapt import ObjectProxy
from box import Box
class BoxObject(ObjectProxy):
"""
Wrapper for any Python object with a Box as __dict__.
Simple Usage:
import requests
@bhgomes
bhgomes / classproperty.py
Created March 26, 2019 22:52
classproperty
class classproperty(property):
"""Class Property."""
def __get__(self, obj, objtype=None):
"""Wrap Getter Function."""
return super().__get__(objtype)
def __set__(self, obj, value):
"""Wrap Setter Function."""
return super().__set__(type(obj), value)