Skip to content

Instantly share code, notes, and snippets.

# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
#!/bin/bash
if [ "$(echo $USERNAME)" != "root" ]; then
echo "this script needs to be run by root"
exit 1
fi
DOCKER_VERSION=$(docker version| grep -m 1 'Version' | perl -pe 's/.* ([1-9]{2})..*/$1/g;')
if [ "$DOCKER_VERSION" -gt "16" ]; then
function CroppedImage(image,sx,sy,sw,sh){
this.image = image;
this.sx = sx;
this.sy = sy;
this.sw = sw;
this.sh = sh;
}
CroppedImage.prototype.draw = function(context,x,y){
context.drawImage(this.image, this.sx, this.sy, this.sw, this.sh, x, y, this.sw, this.sh)
@goliatone
goliatone / chromebox.md
Created July 15, 2017 23:57
Hacking an ASUS chromebox

ASUS makes a pretty handy Chromebox, and it's handy not just because it's running ChromeOS, it's handy because of everything you can do to the box itself.

The ASUS Chromebox is easily upgradeable, and capable of running just about any linux distribution.

The model I picked up, the M004U has the following specs:

  • Celeron 2955U (1.4GHz) 64 bit Dual core processor with 2MB L3 Cache
  • 2GB DDR3 1600 RAM with 2 slots
  • 16GB SSD HDD
  • 802.11 b/g/n dual-band wireless, Bluetooth 4.0, and gigabit ethernet
@goliatone
goliatone / 1_docker-micro-services.txt
Created July 6, 2017 14:45 — forked from anandgorantala/1_docker-micro-services.txt
Docker setup for nodejs microservices with nginx and rethinkdb
# This shows the setup for two services, an accounts service which connects to a database and a pagerduty service which connects to the pagerduty api
# Directory structure
accounts/
|_ Dockerfile
pagerduty/
|_ Dockerfile
nginx/
|_ conf/
|_ sites.conf
|_ .htpasswd
@goliatone
goliatone / trigger_aws_lambda_from_cli.sh
Created July 5, 2017 00:51
How to trigger a lambda function using the AWS CLI tool
aws lambda invoke
--function-name <lambda function name>
--payload '{
"Records":[{
"s3":{
"bucket":{
"name":"<bucket name>"
},
"object":{
"key": "<key name>"
@goliatone
goliatone / README.md
Created June 29, 2017 14:42
Deploy NATS with Docker

Docker NATS

services:
  nats:
    # https://hub.docker.com/_/nats/
    image: nats
    ports:
    - 4222:4222
 - 8222:8222
@goliatone
goliatone / Docker Compose + NATS example
Created June 29, 2017 14:40 — forked from wallyqs/Docker Compose + NATS example
NATS Docker blog post/HTTP Server
FROM golang:1.6.2
COPY . /go
RUN go get github.com/nats-io/nats
RUN go build api-server.go
EXPOSE 8080
ENTRYPOINT ["/go/api-server"]
#!/bin/sh
#/usr/local/bin/ngrok -log=/path/to/ngrok.log -config=/path/to/ngrok.yml start ssh
/usr/local/bin/ngrok http 80 --log=stdout > ngrok.log &
@goliatone
goliatone / publish
Created June 7, 2017 14:40
Simple NPM publish script
#!/bin/sh
function major {
npm version major && npm publish && npm version patch && git push --tags && git push origin master
}
function minor {
npm version minor && npm publish && npm version patch && git push --tags && git push origin master
}