Skip to content

Instantly share code, notes, and snippets.

View lox's full-sized avatar

Lachlan Donald lox

View GitHub Profile
@lox
lox / Dockerfile
Last active May 26, 2017 04:31
A basic repo that can be cloned for Buildkite Tests
FROM alpine:3.3
RUN apk --update --no-cache add curl && \
curl -Lfs https://github.com/betalo-sweden/await/releases/download/v0.4.0/await-linux-amd64 -o /bin/await && \
chmod +x /bin/await
ENTRYPOINT ["/bin/await"]
## SAVING
if [[ $BUILDKITE_BRANCH == "master" ]]; then
echo "+++ :docker: Saving image $COMPOSE_SERVICE_DOCKER_IMAGE_NAME"
local name="${BUILDKITE_PIPELINE_SLUG}_${BUILDKITE_BRANCH}_${COMPOSE_SERVICE_NAME}"
local slug=/tmp/docker-cache/$name.tar.gz
local BUILDKITE_IMAGE_CACHE_BUCKET="xxx-docker-cache"
local images_file=s3://$BUILDKITE_IMAGE_CACHE_BUCKET/$name.images
local images=$(echo $(docker images -a | grep $(echo $BUILDKITE_JOB_ID | sed 's/-//g') | awk '{print $1}' | xargs -n 1 docker history -q | grep -v '<missing>'))
@amrocha
amrocha / Dockerfile
Created July 11, 2016 23:13
Dockerfile and bash script that builds node-sass binaries for Alpine Linux
#####
# Running:
# --------
# ./build.sh
#######
FROM mhart/alpine-node:6
### setup ###
@glennschler
glennschler / Block VNC ARD.md
Last active October 6, 2020 07:51
Firewall setting notes using PFCTL not IPFW on OS X

Referencing this discussion on how to deny loopback access, create the opposite which is to only allow access from localhost. The goal is to only allow access after the client has connected with SSH using the port tunneling option.

Add new filter rules to block VNC (port 5900) access when not connected via SSH with port forwarding. Plus add blocks to file sharing (SMB and AFP). Just in case I am running a web server block that too, or any other ports listed in this link.

# pfctl is the packet filter firewall for modern OS X. 
# For more info -> man pfctl
# flush to the default
@ifels
ifels / golang_pipe_http_response.go
Last active February 1, 2023 19:19
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024
@lox
lox / mirror_test.sh
Last active November 7, 2023 17:33
A bash script to select the fastest ubuntu apt geo-mirror
#!/bin/bash -e
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
RELEASE=$(lsb_release -c -s 2>/dev/null || echo 14.04)
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$RELEASE/main/binary-amd64/Packages.bz2"
TIMEOUT=1
@lox
lox / watch.rb
Created April 20, 2012 05:57
Watch a local folder and synchronize it with a remote folder over SCP
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
require 'optparse'
require 'net/ssh'
require 'net/sftp'
def watch_directory(sftp, watch_dir, target_dir)
fsevent = FSEvent.new
@danielfaust
danielfaust / samsung_remote.py
Created May 30, 2011 04:12
Samsung TV Remote Control Python Script
import time
import socket
import base64
src = '192.168.1.2' # ip of remote
mac = '00-AB-11-11-11-11' # mac of remote
remote = 'python remote' # remote name
dst = '192.168.1.3' # ip of tv
app = 'python' # iphone..iapp.samsung
@lox
lox / dns.rb
Created April 28, 2011 18:54
Creating easy domain references to EC2 instances
#!/usr/bin/env ruby
require 'rubygems'
require 'fog'
ACCESS_KEY_ID='BLARGH'
SECRET_ACCESS_KEY='BLARGH'
ZERIGO_EMAIL='BLARGH'
ZERIGO_TOKEN='BLARGH'
ZERIGO_ZONE='BLARGH'
@lox
lox / phark_proposal.md
Created November 23, 2010 04:03
A proposal for a sane php package manager

Proposal for Phark, a sane php package manager

As it stands PEAR sucks. It's complicated, clumsy and is full of utter garbage (sorry).

PHP is rapidly dying because we don't have any decent way of writing code that can easily build on the work of others. What we need is a simple, open package management system like rubygems.

We now have decent support for namespaces, class autoloading and archives. I propose we abandon