Skip to content

Instantly share code, notes, and snippets.

View ashleyconnor's full-sized avatar
🏠
Working from home

Ashley Connor ashleyconnor

🏠
Working from home
View GitHub Profile
@ashleyconnor
ashleyconnor / async-await.js
Created December 4, 2016 14:56
async/await example
async function main () {
try {
const res = await fetch('https://api.github.com/orgs/facebook');
const json = await res.json();
console.log(json);
} catch (e) {
// handle error
}
}
Server listening on :: port 33333.
debug3: fd 5 is not O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug3: send_rexec_state: entering fd = 8 config len 760
debug3: ssh_msg_send: type 0
debug3: send_rexec_state: done
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 99.254.XXX.XXX port 56834 on 158.69.75.XXX port 33333
debug1: Client protocol version 2.0; client software version Go
@ashleyconnor
ashleyconnor / output.sh
Created July 24, 2016 20:29
Output from gitlab > dokku push
$ git push dokku@mydokku.com:phoenix master
Warning: Permanently added the ECDSA host key for IP address '8.8.8.8' to the list of known hosts.
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
@ashleyconnor
ashleyconnor / Berksfile
Created August 8, 2015 05:27
Vagrantfile for Berkshelf and Chef Zero
source "https://supermarket.chef.io"
cookbook 'apt', '~> 2.7.0'
cookbook 'build-essential', '~> 2.2.3'
cookbook 'git', '~> 4.3.3'
cookbook 'heroku-toolbelt', '~> 0.1.0'
cookbook 'imagemagick', '~> 0.2.3'
cookbook 'nginx', '~> 2.7.6'
cookbook 'nodejs', '~> 2.4.0'
cookbook 'postgresql', '~> 3.4.20'
input {
tcp { port => 3333 type => "json" }
stdin {
type => "stdin-type"
}
file {
type => "syslog"
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
@ashleyconnor
ashleyconnor / logstash.conf
Last active August 29, 2015 14:19
Example logstash config
input {
tcp { port => 3333 type => "json event" codec => json_lines {} }
stdin {
type => "stdin-type"
}
file {
type => "syslog"
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
#!/bin/sh
# init.d script for basexserver http://basex.org/
# (c) 2012 Andy Bunce <bunce.andy@gmail.com>, BSD
# (c) 2015 Ashley Connor <ashconnor@me.com>, LICENSE AS ABOVE
### BEGIN INIT INFO
# Provides: basex-server
# Required-Start: $syslog
# Required-Stop: $syslog
@ashleyconnor
ashleyconnor / Elixir
Last active October 31, 2021 12:11
Elixir Socket Example
defmodule SocketPlayground do
def listen(port) do
listen(port, &handler/1)
end
def listen(port, handler) do
IO.puts "listen"
Socket.TCP.listen!(port, packet: :line)
|> accept(handler)
end
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems: