Skip to content

Instantly share code, notes, and snippets.

View holybit's full-sized avatar

Joseph Crotty holybit

View GitHub Profile

Keybase proof

I hereby claim:

  • I am holybit on github.
  • I am joecrotty (https://keybase.io/joecrotty) on keybase.
  • I have a public key ASAqAIy9J8P0gpEfEeah_TM0OkJa01AQj039s8qKYa9_ywo

To claim this, I am signing this object:

@holybit
holybit / middleware.py
Last active May 26, 2017 01:04
Django custom module endpoint URL problem
# Django v1.7.7 - no I can't upgrade due to factors beyond my control
# This file, middleware.py, is in a Django app directory and correctly added to MIDDLEWARE_CLASSES.
# Currently, I get a 404 when tring to access localhost:8000/liveness/
# Howver, I can't figure out what the urlpatterns should be for the
# the liveness/ and readiness/ endpoints.
import logging
from django.http import HttpResponse, HttpResponseServerError
@holybit
holybit / foo.bash
Last active May 4, 2017 20:10
neovim airblade/vim-gitgutter issue
$ nvim --version  ✓  10566  14:02:06
NVIM v0.2.0
# Since upgrading Neovim I am getting errors when opening files
# that are in git repos. gitgutter seems to be culprit but no idea why?
# If I remove following from plug.vim git repo files load w/o error.
# Plug 'airblade/vim-gitgutter'
$ nvim ~/code/terraform-thing/baseline.tf
# After pressning enter to work through the error messages in nvim
@holybit
holybit / bash shell.sh
Last active January 13, 2017 20:59
bash cli command not working
$ bash --version
GNU bash, version 4.3.46(1)-release (x86_64-cros-linux-gnu)
...
$ pwd
/tmp
$ /bin/bash -c echo -e "{\n \"credStore\": \"ecr-login\"\n}" >> /tmp/config.json
$ cat config.json
# /tmp/config.json has one blank line
@holybit
holybit / results.sh
Last active December 20, 2016 17:41
Boto3 S3 bucket.copy() not working as documented
$ ./test.py
archived/prod/20151119/DMARC-AUTH/archive_prod_2015111911_45_0.json.gz
Traceback (most recent call last):
File "./test.py", line 28, in <module>
main()
File "./test.py", line 25, in main
bucket.copy(copy_source, key)
AttributeError: 's3.Bucket' object has no attribute 'copy'
# according to the boto3 docs there is a bucket.copy()
@holybit
holybit / examples.json
Last active May 25, 2016 20:15
JQ filter problem
# Create jq filter for JSON below that prints "foobar" by testing for which object has Key == "Name" in Tags array.
# However, if the object where Key == "Name" is removed the answer should be null and only one null
{
"Tags": [
{
"Value": "CORE",
"Key": "aws:elasticmapreduce:instance-group-role"
},
{
@holybit
holybit / analytics.json
Last active May 6, 2016 16:44
Packer condistional ansibl-local provisioner w/ variable
{
"variables": {
"aws_access_key": "",
"aws_secret_key": "",
"build_type": "general"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
@holybit
holybit / 1-run_rsyslog
Last active February 20, 2019 14:56
Getting a syntax error when starting rsyslogd. "& stop" seems to be the culprit but I am clearly not understanding something.
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
$ /usr/sbin/rsyslogd -v
rsyslogd 7.4.7, compiled with:
FEATURE_REGEXP: Yes
FEATURE_LARGEFILE: No
GSSAPI Kerberos 5 support: Yes
FEATURE_DEBUG (debug build, slow code): No
32bit Atomic operations supported: Yes
@holybit
holybit / composer.json
Last active August 29, 2015 14:21
PHP composer problem
{
"name": "xyz/foo_web",
"description": "Foo Website",
"type": "project",
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{
@holybit
holybit / apache-access_jsonlog-postmaster.dev.returnpath.net.log
Last active August 29, 2015 14:14
how to get logstash to output key=value pairs from JSON? For example, from below JSON
{"@timestamp":"2015-02-05T12:52:21-0700","@version":"1","tags":["apache","access"],"docker":{"container_id":"CONTAINER_ID","host":"HOST"},"product":"PRODUCT","container_id":"1","bytes":"0","client_ip":"127.0.0.1","client_port":"53053","duration_micros":"219","http_method":"OPTIONS","keepalive":"-","method":"OPTIONS","pid":"117","protocol":"HTTP/1.0","referer":"-","request":"*","response_code":"200","response_size":"-","server_ip":"127.0.0.1","service_port":"80","session_id":"-","site":"-","status":"200","url_path":"*","url_query":"","user":"-","user-agent":"Apache/2.4.6 (CentOS) PHP/5.4.16 (internal dummy connection)","poma_user_id":"-","vhost":"-","X-Forwarded-For":"-"}