Skip to content

Instantly share code, notes, and snippets.

View akrabat's full-sized avatar

Rob Allen akrabat

View GitHub Profile
@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")
@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
#!/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 / 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
@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 / 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 / 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
|\ \
Verifying that +akrabat is my blockchain ID. https://onename.com/akrabat
@akrabat
akrabat / instructions.md
Last active August 29, 2015 14:23
Downgrade joindin-vm to 5.5
  1. Update Vagrantfile. Change:

     ji_config.vm.box = 'joindin/development'
    

    to

     ji_config.vm.box = 'puphpet/debian75-x64'
    
  2. Update puppet/modules/joindin/templates/dotdeb.sources.list. Change:

@akrabat
akrabat / slim-container-examples.php
Last active April 28, 2020 08:14
Example uses of Slim 3's container
<?php
// All file paths relative to root
chdir(dirname(__DIR__));
require "vendor/autoload.php";
$settings = ['foo' => 'FOO', 'bar' => 'BAR'];
$app = new \Slim\App($settings);
// Set some things into the container