Skip to content

Instantly share code, notes, and snippets.

View bguiz's full-sized avatar

Brendan Graetz bguiz

View GitHub Profile
@bguiz
bguiz / book.pdf
Last active February 7, 2021 03:39
tex-overlay-text-on-graphics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bguiz
bguiz / yubi_gpg.sh
Created October 6, 2020 09:30 — forked from luisfontes19/yubi_gpg.sh
Yubikey GPG config
#!/bin/zsh
##
## This automation was created to be used with MACOS based on the instructions from drduh
## (https://github.com/drduh/YubiKey-Guide)
##
## You need to install gpg first:
## brew install gnupg hopenpgp-tools ykman pinentry-mac
## and GPG Suite can also come in handy (https://gpgtools.org/)
##
// web3 provider with fallback for old version
window.addEventListener('load', async () => {
// New web3 provider
if (window.ethereum) {
window.web3 = new Web3(ethereum);
try {
// ask user for permission
await ethereum.enable();
// user approved permission
{"id": "0d593b03242553b24568b3dbccceadd8cb419795091f6e75267f37d8e6100771c10b3bd55285eae9adc99c3e1b0a770f152e132c20c8425b94d43c7d65fc36a9"}
@bguiz
bguiz / .block
Last active September 28, 2018 03:08
license: gpl-3.0
height: 700
border: no

Why

  • You want to do a minor edit to files on another branch
  • The copy of the git repo that you have locally is in a state that is too much effort to clean up/ revert/ stash etc to bother

How

  • simply clone the repo in a different folder
  • but this clone is minimal, so it's much faster
> 0b11111111111111110000000000000000 - 0b100000000000000000
4294770688
> ((0xffff - 2) * 0x10000)
4294770688
> ((0xffff - 2) << 16)
-196608 # WHY??>?
> ((0xffff - 2) << 16) >>> 0
4294770688
@bguiz
bguiz / README.md
Last active August 22, 2017 13:04
Custom NodeJs REPL

Custom NodeJs REPLs

A way to create read-eval-print-loops for your own projects, with a per-instance history, rather than a global history.

Sample Usage

@bguiz
bguiz / RouteListener.js
Last active July 24, 2017 23:14
onUpdate in react-router-4
import { Component } from 'react';
import PropTypes from 'prop-types';
function RouteListenerFactory(plugins = []) {
plugins.forEach((plugin, pluginIdx) => {
if (!plugin.name) {
plugin.name = `routeListenerPlugin#${pluginIdx}`;
}
if (!plugin.initialise) {
@bguiz
bguiz / npm-path-extras.sh
Created August 25, 2016 00:06
See what npm run prepends to the PATH
$ pwd
/Users/bguiz/code/scratch-project
$ echo ${PATH}
/Users/bguiz/.nvm/versions/node/v4.4.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ npm run print-my-path # "print-my-path": "echo ${PATH}"
> scratch-project@0.8.2 print-my-path /Users/bguiz/code/scratch-project
> echo ${PATH}
/Users/bguiz/.nvm/versions/node/v4.4.7/lib/node_modules/npm/bin/node-gyp-bin:/Users/bguiz/code/scratch-project/node_modules/.bin:/Users/bguiz/.nvm/versions/node/v4.4.7/bin:/Users/bguiz/.nvm/versions/node/v4.4.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin