Skip to content

Instantly share code, notes, and snippets.

View akrabat's full-sized avatar

Rob Allen akrabat

View GitHub Profile
Verifying that +akrabat is my blockchain ID. https://onename.com/akrabat
@akrabat
akrabat / 1-before.txt
Last active April 7, 2016 08:38
1. git log --oneline --decorate --all --graph, 2. git rebase -i -p upstream/gh-pages
rob@swiftsure /www/oss/Slim-Website (gh-pages)$ git log --oneline --decorate --all --graph
* 1b65ada (HEAD -> gh-pages, origin/gh-pages, origin/HEAD) Merge pull request #137 from zmip/patch-1
|\
| * e87a3fc Expanded and corrected doc on PSR7 URI object
* | 83c6906 Merge pull request #138 from jsmrls/patch-1
|\ \
| * | 0d35b77 Make example redirection temporary instead of permanent
|/ /
* | 9a7a90a Merge pull request #136 from tflight/patch-1
|\ \
@akrabat
akrabat / Foo.php
Last active April 12, 2016 09:49
Dependencies in Slim Framework
<?php
namespace App;
class Foo
{
protected $db;
public function __construct(PDO $db)
{
$this->db = $db;
@akrabat
akrabat / getcert.sh
Created May 17, 2016 14:09
Get an SSL cert using the command line
echo | openssl s_client -showcerts -servername mozilla.org -connect mozilla.org:443 2>/dev/null | openssl x509 -inform pem -noout -text
@akrabat
akrabat / build.txt
Created May 30, 2016 16:11
Compile swift-corelibs-libdispatch
$ cd /vagrant
$ git clone -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git
$ cd swift-corelibs-libdispatch
$ git submodule init
$ git submodule update
$ sh ./autogen.sh
$ ./configure --with-swift-toolchain=/home/vagrant/swiftenv/versions/DEVELOPMENT-SNAPSHOT-2016-05-03-a/usr --prefix=/home/vagrant/swiftenv/versions/DEVELOPMENT-SNAPSHOT-2016-05-03-a/usr
$ make
$ make install
#!/bin/bash
# Capture currently focussed window using https://github.com/vorgos/QuickGrab
#
# Run screenshot.sh, then cmd+tab to window you want to capture within 2 seconds.
# Screenshot file is then stored on your desktop
sleep 2; quickgrab -file ~/Desktop/screenshot-`date '+%Y%m%d-%H%M%S'`.png
@akrabat
akrabat / script.sh
Created August 9, 2016 13:05
Install clang-3.8 on Ubuntu 14.04
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
sudo cat "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get -qq --assume-yes install clang-3.8 lldb-3.8
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
@akrabat
akrabat / main.swift
Last active October 9, 2016 09:53
Kitura "Hello world": /ping
import Kitura
import SwiftyJSON
let router = Router()
router.get("/ping") { _, response, next in
// see http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
let date = Date()
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_GB")

Things to do before leaving

  • Slides to USB key
  • Backup laptop & ensure Dropbox has sync'd
  • git push all the things!
  • Charge camera batteries

Tech stuff

  • Laptop
@akrabat
akrabat / index.php
Created November 17, 2016 17:52
Use original request in Slim 3 middleware
<?php
$app->add(function ($request, $response, $next) {
// use the original request and ignore the one passed into us
$request = $this->get('request');
// do something here
// continue
return $next($request, $response);
});