Skip to content

Instantly share code, notes, and snippets.

View imbriaco's full-sized avatar

Mark Imbriaco imbriaco

View GitHub Profile
### Keybase proof
I hereby claim:
* I am imbriaco on github.
* I am imbriaco (https://keybase.io/imbriaco) on keybase.
* I have a public key ASA2X3VhgO3_XxpAeRQuZSP6qtcaeTrFu5ZD2bzUIa7l7Ao
To claim this, I am signing this object:
@imbriaco
imbriaco / 00-README.md
Last active May 26, 2018 08:02
Example deployment descriptor for running Cog on Kubernetes. Uses the secret store as well as persistent disks for Postgres, Cog, and Relay data.

Cog on Kubernetes

This experiment was originally built on Google Cloud's Kubernetes and makes use of gcePersistentDisk. If you are not using Google Cloud, you'll need to adjust the gcePersistentDisk volumes to use the persistent disk technology available in your cluster.

At a high level the steps look something like this, though there may be subtle errors. This experiment happened a few weeks ago and I'm creating these from memory along with the test descriptors I used.

  1. Setup Kubernetes and create the necessary persistent disks that are referenced in the deployment.
@imbriaco
imbriaco / 01-main.tf
Last active June 8, 2016 22:16
I'll take stupid Terraform tricks for $500, Alex
module "my_instance" {
source = "../path/to/crazy_module.tf"
...
count = 1
include_eip = "true"
}
@imbriaco
imbriaco / example.md
Last active February 19, 2016 20:25
Cog Sneak Peek

Cog Sneak Peek

This is just a quick example of what adding a very simple shell script as a Cog command would look like. Everything is a work in progress at this stage of alpha and this command does not make use of many of the advanced features in Cog, but I thought folks might find it interesting.

This is a representation of what it would look like if I (@imbriaco) were talking to a bot named cog that was running this bundle.

imbriaco: @cog: simple foo bar baz
cog:

ARG[0]: foo
2015-12-11 14:06:52.247 [error] GenServer #PID<0.615.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for %Ecto.Changeset{action: :insert, changes: %{command_id: "183926b9-1fc9-46d4-bbfa-6f675469825a", id: "23c0aaa6-4aa0-4b18-b286-8ea851d2ccf2", parse_tree: "{\"score\":0,\"permission_selector\":{\"perms\":{\"value\":\"ec2:read\",\"quotes\":null,\"line\":1,\"col\":35,\"$ast$\":\"string\"},\"op\":\"has\",\"line\":1,\"col\":35,\"$ast$\":\"perm_expr\"},\"command_selector\":{\"right\":{\"value\":\"ec2:list\",\"quotes\":null,\"line\":1,\"col\":16,\"$ast$\":\"string\"},\"parens\":false,\"op\":\"is\",\"line\":1,\"left\":{\"name\":\"command\",\"$ast$\":\"var\"},\"col\":13,\"$ast$\":\"binary_expr\"},\"command\":\"ec2:list\",\"$ast$\":\"rule\"}", score: 0}, constraints: [%{constraint: "rules_command_id_parse_tree_index", field: :no_dupes, message: "has already been taken", type: :unique}], errors: [no_dupes: "has already been taken"], filters: %{}, model: %Loop.Models.Rule{__meta__: #Ecto.
dynamic!(:my_security_group, :nat, {
:description => 'My Shiny Security Group',
:ingress => [
{
:cidr_ip => '0.0.0.0/0',
:ip_protocol => 'icmp',
:from_port => -1,
:to_port => -1
}
]
@imbriaco
imbriaco / README.md
Last active August 29, 2015 14:27
Shortcut hack for "Add to Wunderlist" in Safari on OSX Yosemite.

This script tells the OSX UI server to click the "Add to Wunderlist" menu item. This is a horrible hack because the system preference to add shortcuts does not appear to work on the Share menu for Safari, at least with Yosemite. I combined this with a very simple Alfred workflow that is bound to a hotkey in order to trigger the script when I hit CMD-Y in Safari. It feels super crude, but it does ultimately do what I want.

Is there a better way?

[mark@beast /mnt/tank/media]$ zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tank 10.9T 3.27T 7.61T 30% 1.00x DEGRADED /mnt

Keybase proof

I hereby claim:

  • I am imbriaco on github.
  • I am imbriaco (https://keybase.io/imbriaco) on keybase.
  • I have a public key whose fingerprint is 12F8 A46C ED68 CE92 6A12 CD2B 1EB2 4C04 4921 45F9

To claim this, I am signing this object:

@imbriaco
imbriaco / gist:5605757
Created May 18, 2013 20:53
Hacking on a Ruby client for the new Arista Networks Command API
[1] pry(main)> host, user, password = %w(EAPI_HOST EAPI_USER EAPI_PASSWORD).map { |n| ENV[n] }; nil
=> nil
[2] pry(main)> Arista::EAPI::Switch.new(host, user, password).version
=> {:model_name=>"DCS-7048T-A-R",
:internal_version=>"4.12.0-1244071.EOS4120",
:system_mac_address=>"00:1c:73:16:c2:c8",
:serial_number=>"*redacted*",
:mem_total=>4009152,
:bootup_timestamp=>1368735672.686644,
:mem_free=>1851640,