Skip to content

Instantly share code, notes, and snippets.

View redshiftzero's full-sized avatar
🐉
✧・゚: *✧・゚:* (⊃。•́‿•̀。)⊃ *:・゚✧*:・゚✧

redshiftzero redshiftzero

🐉
✧・゚: *✧・゚:* (⊃。•́‿•̀。)⊃ *:・゚✧*:・゚✧
View GitHub Profile
@redshiftzero
redshiftzero / corrsnips
Last active August 29, 2015 14:16
Useful snippets for computing correlation functions
#!/usr/bin/env python
import sys
import pdb
import numpy as np
import math
try:
from esutil import coords
import esutil
@redshiftzero
redshiftzero / README.md
Created July 15, 2016 22:04
Tests example for Jan for Python 2.7

python 2.7 test example

run with:

python tests/test_pipeline.py

@redshiftzero
redshiftzero / gpm.py
Last active February 11, 2017 22:02
Data Refuge SF Bay 2017: Scraper for precipitation data on http://svs.gsfc.nasa.gov/Gallery/GPM.html
import bs4 as BeautifulSoup
import os
import pandas as pd
import time
from tqdm import tqdm
from urllib.request import urlopen
import werkzeug
import wget
@redshiftzero
redshiftzero / app-staging
Created March 14, 2017 21:33
SecureDrop testinfra test failures
===================================================================== FAILURES ======================================================================
_______________________________________________ test_ip6tables_drop_everything[ansible://app-staging] _______________________________________________
[gw3] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
Command = <command>, Sudo = <sudo>
def test_ip6tables_drop_everything(Command, Sudo):
"""
Ensure that all IPv6 packets are dropped by default.
The IPv4 rules are more complicated, and tested separately.
"""
@redshiftzero
redshiftzero / app-staging
Created March 15, 2017 02:22
testinfra part 2
============================================================================================= FAILURES ==============================================================================================
____________________________________________________________________________ test_iptables_rules[ansible://app-staging] _____________________________________________________________________________
[gw2] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
Command = <command>, Sudo = <sudo>
def test_iptables_rules(Command, Sudo):
"""
Ensure the correct iptables rules are checked. Using a single string
equivalency check for the entirety of the iptables output, since
rule order is critical. Testinfra will provide diffed output on failure.
@redshiftzero
redshiftzero / beep
Created April 4, 2017 21:11
vagrant provision /staging/
TASK: [install-local-packages | Install locally built deb packages (via apt).] ***
failed: [app-staging] => (item=(0, u'securedrop-ossec-agent-2.8.2+0.3.11-amd64.deb')) => {"failed": true, "item": [0, "securedrop-ossec-agent-2.8.2+0.3.11-amd64.deb"]}
stderr: dpkg: error: unknown force/refuse option `yes'
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
======================================================= FAILURES =======================================================
____________________________________ test_app_iptables_rules[ansible://app-staging] ____________________________________
[gw3] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
SystemInfo = <testinfra.modules.base.SystemInfo object at 0x10fcdabd0>
Command = <command>, Sudo = <sudo>
def test_app_iptables_rules(SystemInfo, Command, Sudo):
# Build a dict of variables to pass to jinja for iptables comparison
kwargs = dict(
============================================== FAILURES ===============================================
___________________________ test_app_iptables_rules[ansible://app-staging] ____________________________
[gw1] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
SystemInfo = <testinfra.modules.base.SystemInfo object at 0x10ee32dd0>
Command = <command>, Sudo = <sudo>
def test_app_iptables_rules(SystemInfo, Command, Sudo):
# Build a dict of variables to pass to jinja for iptables comparison
kwargs = dict(
@redshiftzero
redshiftzero / verylongls.txt
Created October 3, 2017 22:48
ls -lR /vagrant/securedrop
vagrant@development:/vagrant/securedrop$ ls -lR /vagrant/securedrop
/vagrant/securedrop:
total 356
-rw-r--r-- 1 vagrant vagrant 148 Sep 26 17:49 babel.cfg
-rw------- 1 vagrant vagrant 3865 Sep 26 18:19 config.py
-rw------- 1 vagrant vagrant 2410 Sep 26 18:19 config.pyc
-rw-r--r-- 1 vagrant vagrant 3808 Sep 26 17:49 config.py.example
-rw-r--r-- 1 vagrant vagrant 34520 Sep 26 17:49 COPYING
-rw-r--r-- 1 vagrant vagrant 6770 Oct 3 22:39 crypto_util.py
-rw-r--r-- 1 vagrant vagrant 6953 Oct 3 22:39 crypto_util.pyc
@redshiftzero
redshiftzero / loadtest.txt
Created January 14, 2018 00:48
load testing FPF's tor apt mirror
$ hey -z 1m -c 50 -m GET https://tor-apt.freedom.press/dists/trusty/Release
Summary:
Total: 60.3476 secs
Slowest: 1.2616 secs
Fastest: 0.0277 secs
Average: 0.0860 secs
Requests/sec: 578.8131
Total data: 101995600 bytes
Size/request: 2920 bytes