Skip to content

Instantly share code, notes, and snippets.

@seanherron
seanherron / .gitignore
Created December 29, 2020 18:01
simple-eleventy-base-.gitignore
# .gitignore
# node.js artifacts
node_modules
# Build artifacts
dist
.tmp
.env
# Random files your computer may generate
.vscode
.DS_Store
@seanherron
seanherron / deploy.sh
Created May 18, 2015 19:44
18F Cloud Foundry Blue/Green Deploy Script
#!/bin/sh
set -e
app_name="INSERT_YOUR_APP_NAME"
timestamp="$(date +"%s")"
current_apps="$(cf apps)"
deploy()
if [log_type] == "nginx-error" {
grok {
match => [
"message", "%{DATA} %{WORD:webserver} %{HOST:myhost}\-%{WORD:class}\: (?%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME}) \[%{LOGLEVEL:severity}\] %{POSINT:pid}#%{NUMBER}: %{GREEDYDATA:errormessage}(?:, client: (?%{IP}|%{HOSTNAME}))(?:, server: %{IPORHOST:server})(?:, request: %{QS:request})?(?:, host: %{QS:host})?(?:, referrer: \”%{URI:referrer})",
"message", "%{DATESTAMP:timestamp} \[%{LOGLEVEL:severity}\] %{GREEDYDATA:errormessage}"
]
}
date {
locale => "en"
match => [ "time_local", "dd/MMM/YYYY:HH:mm:ss Z" ]
{:timestamp=>"2014-12-05T21:08:46.243000+0000", :message=>"+---------------------------------------------------------+\n| An unexpected error occurred. This is probably a bug. |\n| You can find help with this problem in a few places: |\n| |\n| * chat: #logstash IRC channel on freenode irc. |\n| IRC via the web: http://goo.gl/TI4Ro |\n| * email: [email protected] |\n| * bug system: https://logstash.jira.com/ |\n| |\n+---------------------------------------------------------+\nThe error reported is: \n invalid multibyte character: /(?<a0>.*?) (?<a1>\\b\\w+\\b) (?<a2>(?<a3>\\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\\.?|\\b)))\\-(?<a4>\\b\\w+\\b)\\: (?(?<a5>(?>\\d\\d){1,2})[.\\/-](?<a6>(?:0?[1-9]|1[0-2]))[.\\/-](?<a7>(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9]))[- ](?<a8>(?!<[0-9])(?<a9>(?:2
@seanherron
seanherron / gist:68033cdf399f3ba3b2a7
Created September 2, 2014 05:47
Sublime Settings
{
"color_scheme": "Packages/Base16/base16-tomorrow.dark.tmTheme",
"font_face": "Source Code Pro Light",
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
◢◣
││
││
││
╱▂▂╲
│ ⚐⚐ │
│▄▄▄▄│
│▒▒▒▒│
╱▂▂▂▂╲
│▌▒▌▒▌▌│
@seanherron
seanherron / indexer.py
Created February 25, 2014 12:39
RIDB ES Indexer
from lxml import etree
from pyelasticsearch import ElasticSearch
es = ElasticSearch('http://localhost:9200/')
def RecArea(filename):
ns = etree.FunctionNamespace("http://www.recreation.gov/architecture/")
ns.prefix = "arc"
doc = etree.parse(filename)
for area in doc.xpath('//arc:RecArea'):
#!/usr/bin/env python
#!/usr/bin/env python
import scraperwiki
import requests
import lxml.html
import lxml.etree
import string
import md5