Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Battersby ianbattersby

View GitHub Profile
@ianbattersby
ianbattersby / colours.sh
Created Nov 12, 2018
Display full colour range in terminal window
View colours.sh
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s s s s s s s s s s s s s s s s;
for (colnum = 0; colnum<256; colnum++) {
r = 255-(colnum*255/255);
g = (colnum*510/255);
b = (colnum*255/255);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
@ianbattersby
ianbattersby / cURLs.sh
Created Dec 1, 2015
Example of a more complicated EventStore projection using GitHub API data
View cURLs.sh
# Push an IssuesEvent into ES (with known issue number)
curl -i -L -d @example-issues-event.json http://127.0.0.1:2113/streams/github-IssuesEvent -H "Content-Type:application/json" -H "ES-EventType:IssuesEvent" -u "admin:changeit"
# Push a PushEvent into ES (has a commit description with required match)
curl -i -L -d @example-push-event.json http://127.0.0.1:2113/streams/github-PushEvent -H "Content-Type:application/json" -H "ES-EventType:PushEvent" -u "admin:changeit"
# Push a DeploymentEvent into ES (has a description with required match)
curl -i -L -d @example-DeploymentEvent-desc.json http://127.0.0.1:2113/streams/github-DeploymentEvent -H "Content-Type:application/json" -H "ES-EventType:DeploymentEvent" -u "admin:changeit"
View settings.js
{
"$userStreamAcl" : {
"$r" : "$all",
"$w" : "$all",
"$d" : "$all",
"$mr" : "$all",
"$mw" : "$all"
},
"$systemStreamAcl" : {
"$r" : "$admins",
@ianbattersby
ianbattersby / pump.js
Created Nov 25, 2015
Pumps GitHubApi events into EventStore (demo)
View pump.js
var githubApi = require("node-github");
var http = require("http");
var timeUntilNextEvents = 10000;
var last_created_at = new Date();
var overlapped = false;
var uuid = (function() {
var self = {};
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
self.generate = function() {
@ianbattersby
ianbattersby / pump-unauth.js
Created Nov 25, 2015
Pumps GitHubApi events into EventStore - unauthenticated (demo)
View pump-unauth.js
var http = require('http');
var https = require('https');
var timeUntilNextEvents = 10000;
var last_created_at = new Date();
var overlapped = false;
var uuid = (function() {
var self = {};
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
self.generate = function() {
View es-notes.md
View travis.sh
#!/bin/sh
# This script will setup Evm (Emacs Version Manager) and Cask on
# Travis to use for Emacs Lisp testing.
#
# In .travis.yml, add this:
#
# - curl -fsSkL https://gist.github.com/ianbattersby/c3399aa8cd9e2a6f8afa/raw > travis.sh && source ./travis.sh
#
# Emacs 24.3 is installed in the above script because Cask requires
View gist:6e9d20802ec59dacfebe
[15200,07,15:26:50.939] Read Request Body Failed.
Value cannot be null.
Parameter name: token
View keybase.md

Keybase proof

I hereby claim:

  • I am ianbattersby on github.
  • I am ianbattersby (https://keybase.io/ianbattersby) on keybase.
  • I have a public key whose fingerprint is E33D 9F6B 8CAF FB9B 419E 7586 EE2D 6FBB 294F 3BE7

To claim this, I am signing this object:

@ianbattersby
ianbattersby / archandwin8.md
Last active Aug 29, 2015
Some notes for Mark from installing Arch side-by-side with existing Windows 8.1 installation
View archandwin8.md

NOTE! If you have a BitLockered Windows partition and TPM this may fail in ways I don't want to comprehend. Un-bitlock first if I were you should that be the case.

NOTE! I wrote most of this from memory, one I regularly volunteer is shocking ;)

Backup shit

  • Boot into Windows and backup your current UEFI partition using BCDEDIT /export
  • Backup Windows if you really give a shit

Before you do anything else

  • Turn off SECURE BOOT in the BIOS and make sure it still boots up into Windows