Skip to content

Instantly share code, notes, and snippets.

@clarkdave
clarkdave / logstash-sentry.rb
Last active May 15, 2023 11:34
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@clarkdave
clarkdave / currencies.json
Last active February 5, 2016 19:17
Currencies parsed from the RubyMoney library - https://github.com/RubyMoney/money - this ONLY includes currencies which have a subunit of 100 (e.g. 100 cents == 1 dollar)
{
"usd": {
"code": "USD",
"symbol": "$",
"name": "United States Dollar",
"symbol_first": true
},
"eur": {
"code": "EUR",
"symbol": "€",
@clarkdave
clarkdave / nconf-yaml.js
Created August 20, 2014 11:19
Load YAML config files using nconf (nodejs)
var nconf = require('nconf');
var yaml = require('js-yaml');
var app_config = __dirname + '../config/application.yml';
// load cmd line args and environment vars
nconf.argv().env();
// load a yaml file using a custom formatter
nconf.file({
@clarkdave
clarkdave / js-center-popup.coffee
Created December 4, 2014 09:50
Create JS popup centered on screen (dual-screen friendly)
# from here: http://www.xtf.dk/2011/08/center-new-popup-window-even-on.html
w = 800
h = 600
dualScreenLeft = if window.screenLeft isnt undefined then window.screenLeft else screen.left
dualScreenTop = if window.screenTop isnt undefined then window.screenTop else screen.top
width = if window.innerWidth then window.innerWidth else (
if document.documentElement.clientWidth then document.documentElement.clientWidth else screen.width)
@clarkdave
clarkdave / gist:609fc3049dcf9c8aa559
Last active August 29, 2015 14:16
gevent ubuntu 12.04 setuptools issue

Error, on Ubuntu 12.04

$ sudo -H pip install gevent
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 232, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 339, in run
    requirement_set.prepare_files(finder)

File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 229, in prepare_files

@clarkdave
clarkdave / sublimetext3.json
Created November 10, 2015 15:49
sublime text 3 config
{
"auto_find_in_selection": true,
"base64fold_all_uris": false,
"bold_folder_labels": false,
"caret_style": "blink",
"color_scheme": "Packages/User/SublimeLinter/Blackboard (SL).tmTheme",
"enable_tab_scrolling": false,
"fade_fold_buttons": false,
"find_selected_text": true,
"font_face": "Source Code Pro Light",
@clarkdave
clarkdave / keybase.md
Created February 12, 2017 23:28
keybase.md

Keybase proof

I hereby claim:

  • I am clarkdave on github.
  • I am clarkdave (https://keybase.io/clarkdave) on keybase.
  • I have a public key ASAAW7KQ7BqcEQjDD--DhGxAF_Ufz_IT71BmARZuxJotRwo

To claim this, I am signing this object:

@clarkdave
clarkdave / ecs-interactive-console.sh
Last active August 21, 2024 08:09
ecs-interactive-console
#!/bin/bash -e
##
# Use this annotated script a base for launching an interactive console task on Amazon ECS
#
# more info: https://engineering.loyaltylion.com/running-an-interactive-console-on-amazon-ecs-c692f321b14d
#
# Requirements:
# - `jq` must be installed on both the client and server
##
@clarkdave
clarkdave / bootstrap-chef-server-12.sh
Last active June 29, 2017 20:07
[CHEF] Bootstrap a Chef Server 12
#!/bin/bash -ex
# Use this script template to bootstrap a Chef Server (version 12)
#
# - bootstraps the Chef server using chef-solo and the official chef-server cookbook
# (https://github.com/chef-cookbooks/chef-server)
# - uses Lego (acme client) to generate and renew an SSL certificate for the server
# - installs the manage (web ui), push jobs and reporting addons (free for < 25 nodes)
# - configures a few sane defaults (no sign ups from web ui)
#
@clarkdave
clarkdave / ecs-task-events-to-cloudwatch-logs.py
Created June 29, 2017 22:27
(AWS Lambda) Send ECS Task events to CloudWatch Logs
# This lambda function can be linked with CloudWatch events to send Task state changes to
# a CloudWatch Logs stream
#
# This is highly recommended as, in my experience, the API does *NOT* return all state change
# events; this is the only way to reliably see them all
import os
import time
import json
import boto3