Skip to content

Instantly share code, notes, and snippets.

@jlintz
jlintz / gist:c9e8cb6fccaaefd5e401cdb55cf28e4f
Created December 2, 2019 01:15
Jets and Giants combined record against the number of games they at the same time in a season
Year: Wins - Losses, # of games at same time
2000: 21 - 11, 0
2001: 17 - 15, 0
2002: 19 - 13, 0
2003: 10 - 22, 1
2004: 16 - 16, 0
2005: 15 - 17, 0
2006: 18 - 14, 0
2007: 14 - 18, 1
@jlintz
jlintz / sync_ec2_tags_ebs.py
Created May 31, 2018 20:58
Sync tags from EC2 instances to attached EBS volumes
#!/usr/bin/env python
"""
Sync tags from ec2 instances onto the volumes that are attached to them
"""
from boto import connect_ec2
def main():
conn = connect_ec2()
volumes = conn.get_all_volumes(filters={
from boto import connect_ec2
def get_ri_costs(connection):
"""
@connection: EC2Connection obj
returns: list
"""
ri_costs = []
ris = connection.get_all_reserved_instances_offerings(include_marketplace=False,
@jlintz
jlintz / gist:1377d69e8717fcf54849
Created December 9, 2015 22:28
logstash error
justin@logstashidx03:~$ sudo /opt/logstash/bin/logstash -t -f /etc/logstash/conf.d/logstash.conf
Bundler::GemNotFound: Could not find nokogiri-1.6.7-java in any of the sources
materialize at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/spec_set.rb:92
map! at org/jruby/RubyArray.java:2446
materialize at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/spec_set.rb:85
specs at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/definition.rb:132
specs_for at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/definition.rb:177
requested_specs at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/definition.rb:166
requested_specs at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/environment.rb:18
setup at /opt/logstash/vendor/bundle/jruby/1.9/gems/bundler-1.9.10/lib/bundler/runtime.rb:13
@jlintz
jlintz / MFA API
Created September 29, 2015 15:26
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyStopAndTerminateWhenMFAIsFalse",
"Effect": "Deny",
"Action": [
"ec2:StopInstances",
"ec2:TerminateInstances"
],
@jlintz
jlintz / gist:feb0f2f797179074b223
Created May 20, 2015 19:10
Logstash log_format for Nginx
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"@version": "1", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"upstream_addr": "$upstream_addr", '
'"upstream_status": "$upstream_status", '
'"upstream_response_time": "$upstream_response_time", '
'"status": "$status", '
'"uri": "$uri", '
@jlintz
jlintz / gist:477697ba07e6851d161b
Last active August 13, 2017 02:44
syslog logstash filter
filter {
if [type] == "syslog" {
grok {
match => { "message" => [ "%{SYSLOGPAMSESSION}", "%{CRONLOG}", "%{SYSLOGLINE}" ] }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
overwrite => [ "message" ] # After we've processed the log we dont need the raw message anymore
}
grep {
@jlintz
jlintz / gist:5674085
Created May 29, 2013 21:46
patch for pagerduty.coffee to remember email addresses properly
--- ./node_modules/hubot-scripts/src/scripts/pagerduty.coffee 2013-04-12 18:05:20.000000000 -0400
+++ ./custom_scripts/pagerduty.coffee 2013-05-28 14:29:25.000000000 -0400
@@ -40,8 +40,13 @@
if missingEnvironmentForApi(msg)
return
- emailNote = if msg.message.user.pagerdutyEmail
- "You've told me your PagerDuty email is #{msg.message.user.pagerdutyEmail}"
+ users = robot.brain.usersForFuzzyName(msg.message.user.name)
+ if users.length is 1
@jlintz
jlintz / gist:5388236
Created April 15, 2013 13:55
happy birthday snakes, compile and run on production
package main
import "fmt"
func main() {
fmt.Printf("happy birthday snakes\n")
}
{
"report_name" : "util",
"report_type" : "standard",
"title" : "util",
"vertical_label" : "Count",
"series" : [
{ "metric": "iostat_sdi_util", "color": "660099", "label": "sdi", "type": "line", "line_width": "2" },
{ "metric": "iostat_sdj_util", "color": "99FF00", "label": "sdj", "type": "line", "line_width": "2" },
{ "metric": "iostat_sdk_util", "color": "FF9900", "label": "sdk", "type": "line", "line_width": "2" },
{ "metric": "iostat_sdl_util", "color": "CC3300", "label": "sdl", "type": "line", "line_width": "2" }