Skip to content

Instantly share code, notes, and snippets.

🌝
Trying to exit emacs

Brian Gordon briangordon

Block or report user

Report or block briangordon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@briangordon
briangordon / gitgraph-react.sh
Last active Mar 29, 2019
Steps to build gitgraph-react to play with the storybook 😵
View gitgraph-react.sh
brew install node
export PATH="$HOME/.node/bin:$PATH"
npm install -g lerna
git clone git@github.com:nicoespeon/gitgraph.js.git
echo "scripts-prepend-node-path=true" >> gitgraph.js/.npmrc
cd gitgraph.js
yarn
cd packages/gitgraph-core
yarn
cd ../gitgraph-react
@briangordon
briangordon / gitgraphjs.html
Created Mar 28, 2019
gitgraphjs.com (https://web.archive.org/web/20181222070223/http://gitgraphjs.com/) gives you the building blocks to start working with the JS version but leaves you to put it together. Here's a fully working example to get it running.
View gitgraphjs.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.15.1/gitgraph.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.15.1/gitgraph.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/domready/1.0.8/ready.js"></script>
<script type="text/javascript">
domready(function() {
var gitgraph = new GitGraph({
template: "blackarrow",
@briangordon
briangordon / make-letters.sh
Created Mar 4, 2019
Shell script to make letter icons for Slack
View make-letters.sh
mkdir letters
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:A letters/a.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:B letters/b.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:C letters/c.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:D letters/d.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:E letters/e.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:F letters/f.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:G letters/g.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:H letters/h.png
convert -background transparent -fill black -font Chalkduster -pointsize 72 label:I letters/i.png
View ufw-config.sh
# UFW configuration for a home DMZ box exposed to the public internet, with only sshd reachable from the outside world.
# In addition to setting these rules you should also:
# 1. Edit /etc/ufw/before.rules to remove the default rules which permit incoming DHCP packets from the outside world.
# 2. Edit /etc/ufw/before.rules to remove the default rules which permit incoming ICMP packets from the outside world.
# 3. Edit /etc/default/ufw to turn off non-local ipv6 because I don't know enough about it to be confident.
ufw default deny incoming
ufw default allow outgoing
ufw limit log proto tcp to 0.0.0.0/0 port ssh
ufw allow proto udp from 192.168.0.0/16 to 0.0.0.0/0 port bootpc comment "required for dhclient"
@briangordon
briangordon / bash_ps1.sh
Last active Feb 3, 2019
By default, Debian only colorizes bash output for regular users. Rather than copy your ~/.bashrc to /root, take just take it out and have /etc/bash.bashrc source this instead.
View bash_ps1.sh
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
@briangordon
briangordon / DefaultKeyBinding.dict
Created Jan 25, 2019
Put this in ~/Library/KeyBindings/ to fix MacOS home/end keys behaving stupidly
View DefaultKeyBinding.dict
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}
View keybase.md

Keybase proof

I hereby claim:

  • I am briangordon on github.
  • I am brian (https://keybase.io/brian) on keybase.
  • I have a public key ASA8l7cfD9ar5ZcXq_MkGZCVjV9B9eo9l1dpQ5D4LsgOsAo

To claim this, I am signing this object:

@briangordon
briangordon / git-review-aliases.txt
Last active Oct 26, 2018
Aliases for code reviewing GitHub pull requests using a GitFlow/OneFlow branching model
View git-review-aliases.txt
*****************************************************************************************************************************
Introduction
The code review workflow that I prefer is to check out a feature branch, then `reset --soft` to move the branch HEAD to
just before the changes. That way I still have all of the changes in my working copy, and those exact changes are staged
for commit. My IDE will highlight the changed lines right in the editor and let me click the gutter to view a quick diff.
This is incredibly useful. But problems arise when develop has been merged into a running PR, bringing along a whole bunch
of other unrelated changes that have already been reviewed. I don't want all of those other changes to be highlighted in
my IDE, but I do want them in my working copy.
View cellfactorytest.scala
package cellfactory
import javafx.application.Application
import javafx.collections.FXCollections
import javafx.scene.control.ListView
import javafx.scene.layout.StackPane
import javafx.scene.{Scene, control => jfxsc}
import javafx.stage.Stage
import javafx.util.Callback
@briangordon
briangordon / gist:df79f7cd3750ac9fe1109553c8262aee
Last active Sep 11, 2017
pureconfig ConfigReader for case class with "auxiliary constructor" type logic
View gist:df79f7cd3750ac9fe1109553c8262aee
case class HalfLife(lowerBoundHours: BigDecimal, upperBoundHours: BigDecimal, meanHours: BigDecimal)
def computeMean(lowerBoundHours: BigDecimal, upperBoundHours: BigDecimal): BigDecimal = {
// TODO linear interpolation is terrible here. These are exponential quantities.
(lowerBoundHours + upperBoundHours) / 2
}
// Hack to get pureconfig to create instances of HalfLife without an explicit mean-hours value.
import com.typesafe.config.{ConfigObject, ConfigValueFactory}
import pureconfig.ConfigReader
You can’t perform that action at this time.