Skip to content

Instantly share code, notes, and snippets.

View myles's full-sized avatar
🦖

Myles Braithwaite myles

🦖
View GitHub Profile
@myles
myles / fabfile.py
Created July 11, 2017 19:25
Fabric File for deploying a Laravel website
import datetime
from fabric.api import cd, env, task, run
from fabric.contrib.project import rsync_project
from fabric.utils import puts
env.hosts = ['127.0.0.1']
env.user = 'serverpilot'
env.app_dir = '~/apps/laravel/'
env.releases_dir = '~/.releases/laravel'
@myles
myles / fabfile.py
Created June 27, 2017 13:21
Trellis Fabric File for Transferring Production to Staging
import datetime
import yaml
from ansible_vault.api import Vault
from fabric.api import env, execute, get, local, put, run, task
env.user = 'root'
env.now = datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S')
env.roledefs = {
@myles
myles / happy_valentines_day.py
Last active February 14, 2017 15:47
happy_valentines_day.py
#!/usr/bin/env python3
import argparse
def encode(secret):
binary = bin(int.from_bytes(secret.encode(), 'big'))
return binary[2:].replace('0', '❤️').replace('1', '💜')
def decode(code):
@myles
myles / App.js
Created January 26, 2017 16:41
Playing around with WordPress REST API and React
import WordPress from 'wpcom';
import { css } from 'glamor'
import React from 'react';
let PostStyle = css({
borderBottomColor: '#ccc',
borderBottomStyle: 'solid',
borderBottomWidth: '1px',
margin: '1em 0',
<html>
<head><title>Fuzzy Search</title>
<script id="algorithm">
// YOUR CODE HERE !
</script>
@myles
myles / Makefile
Created August 22, 2016 12:46 — forked from toolmantim/Makefile
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
location /.well-known/acme-challenge {
root /usr/share/nginx/html;
}
# h5bp is from https://github.com/h5bp/server-configs-nginx
include h5bp/directive-only/ssl.conf;
ssl_certificate /etc/letsencrypt/live/bear.mylesbraithwaite.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bear.mylesbraithwaite.com/privkey.pem;
Verifying that +mylesb is my blockchain ID. https://onename.com/mylesb
mylesb.ca@1.0.0 /Users/Myles/WebSites/ca_mylesb_www
├─┬ assemble@0.7.6
│ ├─┬ ansi-colors@0.1.0
│ │ ├─┬ ansi-bgblack@0.1.1
│ │ │ └── ansi-wrap@0.1.0
│ │ ├── ansi-bgblue@0.1.1
│ │ ├── ansi-bgcyan@0.1.1
│ │ ├── ansi-bggreen@0.1.1
│ │ ├── ansi-bgmagenta@0.1.1
│ │ ├── ansi-bgred@0.1.1
@myles
myles / twtxt.txt
Created February 6, 2016 21:02
Add a twtxt feed to your Jekyll website.
---
layout: null
sitemap: false
permalink: twtxt.txt
---
{% for post in site.posts limit:10 %}{{ post.date | date_to_xmlschema }} {{ post.title }} {% if post.shorturl %}{{ post.shorturl }}{% else %}{{ post.url | prepend: site.baseurl | prepend: site.url }}{% endif %}
{% endfor %}