Skip to content

Instantly share code, notes, and snippets.

View brianlmoon's full-sized avatar

Brian Moon brianlmoon

View GitHub Profile
<?php
if($whatever){
do_stuff();
} else {
$result["success"] = false;
$result["message"] = "FAILURE: Some error message";
}
return $result;
?>
@brianlmoon
brianlmoon / gearman_statsd.lua
Last active October 30, 2015 14:26
Sends stats about a gearmand process to StatsD
#!/usr/bin/lua
-- Requires lua 5.1+ and lua socket
--
-- Copyright (c) 2015, Brian Moon
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
@brianlmoon
brianlmoon / run.tpl
Created November 6, 2018 15:22 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name={{.Name}} \
{{range $e := .Config.Env}}--env={{printf "%q" $e}} \
{{end}}{{range $p, $conf := .NetworkSettings.Ports}}{{with $conf}}-p {{(index $conf 0).HostIp}}:{{(index $conf 0).HostPort}}:{{$p}} \
{{end}}{{end}}{{range $n, $conf := .NetworkSettings.Networks}}{{with $conf}}--network {{printf "%q" $n}} \
{{range $conf.Aliases}}--network-alias {{printf "%q" .}} {{end}} \
{{end}}{{end}}{{range $v := .HostConfig.VolumesFrom}}--volumes-from={{printf "%q" .}} \
{{end}}{{range $v := .HostConfig.Binds}}--volume={{printf "%q" .}} \
{{end}}{{range $l, $v := .Config.Labels}}--label {{printf "%q" $l}}={{printf "%q" $v}} \
{{end}}{{range $v := .HostConfig.CapAdd}}--cap-add {{printf "%q" .}} \