Skip to content

Instantly share code, notes, and snippets.

Avatar
☀️
It's Always Sunny in Seattle

Adam Nelson adamn

☀️
It's Always Sunny in Seattle
View GitHub Profile
@adamn
adamn / gist:1dbfde14f541d818c046430561a0decb
Created Oct 14, 2016
Adding user to stream broken (maybe the user doesn't exist on staging db but does on elastic search?)
View gist:1dbfde14f541d818c046430561a0decb
IntegrityError at /streams/7d654571-6b07-4855-879a-b99c18d804e6/add_access
(1452, 'Cannot add or update a child row: a foreign key constraint fails (`centr_staging`.`stream_streamaccess`, CONSTRAINT `stream_streamaccess_user_id_80bda50c_fk_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user_user` (`id`))')
Request Method: POST
Request URL: https://staging-centr.factr.com/streams/7d654571-6b07-4855-879a-b99c18d804e6/add_access
Django Version: 1.10.2
Python Executable: /var/virtualenvs/centr/bin/python3.5
Python Version: 3.5.2
Python Path: ['/var/www/releases/1476387964-7b83f922', '/var/virtualenvs/centr/bin', '/var/virtualenvs/centr/src/newspaper3k', '/var/virtualenvs/centr/lib/python3.5', '/var/virtualenvs/centr/lib/python3.5/plat-x86_64-linux-gnu', '/var/virtualenvs/centr/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/var/virtualenvs/centr/lib/python3.5/site-packages', '/var/virtualenvs/centr/lib/python3.5/site-packages/newrelic-2.70.0.51', '/var/www/relea
@adamn
adamn / request_from_chase_com
Last active Feb 8, 2016
One more reason financial companies like Chase are ripe for attack
View request_from_chase_com
# These are requests required in order to simply look at checking accounts at Chase.com
# https://www.chase.com/checking
# One need not marvel at the parlous state of affairs in cybersecurity vis a vis major financial institutions
# when they rely on this many third-parties simply to show users a list of available checking accounts
# Attacks via Forbes stemmed from just this type of use of third party ad widgets (http://arstechnica.com/security/2015/02/pwned-in-7-seconds-hackers-use-flash-and-ie-to-target-forbes-visitors/)
# Maybe Obama and the NIST cybersecurity initiative (http://www.nist.gov/cyberframework/) could focus more on the leaking ship of information rather than attacking privacy
# Thanks to µBlock (https://github.com/gorhill/uBlock) and Live HTTP Headers (http://livehttpheaders.mozdev.org/) for the fantastic tools that make finding this stuff easy
#
script https://dev.virtualearth.net/services/v1/ImageryMetadataService/ImageryMetadataService.asmx/GetBirdsEyeSceneByLocation[redacted]
@adamn
adamn / gist:e2d3cebea822ba63d2e0
Created Oct 29, 2014
MTR on JTL Faiba to nation.co.ke
View gist:e2d3cebea822ba63d2e0
13:03:40 ~ $ sudo mtr www.nation.co.ke --report
Start: Wed Oct 29 13:03:44 2014
HOST: adam-2.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.1.1 0.0% 10 1.2 2.3 1.2 3.3 0.7
2.|-- 192.168.201.1 0.0% 10 2.8 3.2 2.4 5.7 0.8
3.|-- 41.57.108.5 0.0% 10 2.5 2.5 2.4 2.8 0.0
4.|-- 41.222.8.217 20.0% 10 106.6 121.7 106.6 144.4 17.5
5.|-- 195.229.27.57 80.0% 10 200.3 204.7 200.3 209.1 6.2
6.|-- 195.229.0.93 30.0% 10 213.3 213.3 195.6 224.1 9.1
7.|-- 195.229.3.177 80.0% 10 295.0 299.0 295.0 302.9 5.5
View Route to kixp down from ihub?
➜ neutron sudo mtr 196.223.21.70 --report
Start: Wed Mar 5 14:08:20 2014
HOST: Adams-MacBook-Air.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.20.1 0.0% 10 2.8 4.3 1.1 10.0 2.8
2.|-- 41.212.36.69.wananchi.com 0.0% 10 5.8 17.7 3.3 39.0 13.6
3.|-- 41.212.1.161 0.0% 10 16.6 7.8 2.2 28.2 8.5
4.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
➜ neutron
View MTRs to Kili (Nairobi) from different places
(kili)➜ Resources sudo mtr dash.kili.io --report
Start: Fri Feb 7 11:01:39 2014
HOST: Adams-MacBook-Air.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 41.188.154.65 0.0% 10 3.5 3.0 1.5 4.2 0.7
2.|-- 41.188.181.93 0.0% 10 2.6 2.7 1.8 4.5 0.6
3.|-- ge-0-0-2-pe.ppf.core.simb 0.0% 10 6.3 22.0 4.8 107.1 31.7
4.|-- 41.188.128.194 0.0% 10 19.2 91.8 18.2 721.1 221.2
5.|-- 41.212.40.241.wananchi.co 0.0% 10 30.4 17.5 15.3 30.4 4.6
6.|-- 41.212.1.162 10.0% 10 235.2 181.4 163.4 235.2 27.3
7.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
View Pinging @gamersnights server
# From home connection (Faiba)
(kili)➜ Resources sudo mtr 41.190.141.245 --report
Start: Wed Feb 5 22:06:15 2014
HOST: Adams-MacBook-Air.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.0.1.1 0.0% 10 1.4 2.4 1.0 8.4 2.2
2.|-- 192.168.1.1 0.0% 10 1.5 29.0 1.2 105.0 43.4
3.|-- 192.168.200.1 0.0% 10 4.0 12.5 2.7 52.4 16.3
4.|-- 41.222.9.105 0.0% 10 2.5 31.7 2.3 101.2 46.1
5.|-- 41.222.8.41 10.0% 10 2.8 9.7 2.6 25.5 9.5
@adamn
adamn / pre-commit
Last active Mar 4, 2016 — forked from spulec/pre-commit
de-yipited and got rid of Sass
View pre-commit
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@adamn
adamn / gist:7788482
Created Dec 4, 2013
Does Google simply allow all Internet hosts in its SPF records?
View gist:7788482
➜ ~ dig @8.8.8.8 _spf.google.com txt
; <<>> DiG 9.8.3-P1 <<>> @8.8.8.8 _spf.google.com txt
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5516
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
@adamn
adamn / gist:1707483
Created Jan 30, 2012
Simple DynamoDB example for time-series data (i.e. counter for a given item_id at a time)
View gist:1707483
import time
import boto
from django.conf import settings
conn = boto.connect_dynamodb(aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY)
table_schema = conn.create_schema(
hash_key_name='item_id',
hash_key_proto_value='S',
@adamn
adamn / celeryd
Created Nov 16, 2010
Example celeryd config file located at /etc/default/celeryd
View celeryd
# This file should be named /etc/default/celeryd and is used by:
# /etc/init.d/celeryd
# http://celeryq.org/
# Where the Django project is.
CELERYD_CHDIR="/var/www/example-env/project-name/"
CELERYD_OPTS="-c 6"
# Name of the projects settings module.
DJANGO_SETTINGS_MODULE="settings.active"