This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ snap install amass | |
... | |
$ amass enum -d cicese.mx -src | |
[DNS] cicese.mx | |
[HackerTarget] imp-udb10.cicese.mx | |
[HackerTarget] wireless-oc211.cicese.mx | |
[RapidDNS] dhcp-ac14.cicese.mx | |
[HackerTarget] pc-lankahuasa1.cicese.mx | |
... | |
[RapidDNS] cicese-auditorio.cicese.mx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from plone import api | |
import transaction | |
def get_least_used(limit=1): | |
"""List all keywords used up to limit times in content.""" | |
catalog = api.portal.get_tool('portal_catalog') | |
keywords = catalog.uniqueValuesFor('Subject') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from plone import api | |
import transaction | |
def normalize(): | |
"""Remove spare spaces and transform keywords to lowercase.""" | |
catalog = api.portal.get_tool('portal_catalog') | |
results = catalog() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pkg_resources | |
import logging | |
logger = logging.getLogger('zc.monitor') | |
try: | |
pkg_resources.get_distribution('zc.monitor') | |
except pkg_resources.DistributionNotFound: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import directors; | |
# probe definition for health checks | |
probe healthcheck { | |
.interval = 2s; | |
.url = "/haproxy?monitor"; | |
.timeout = 1s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration file for HAProxy | |
# | |
# This file must me symlinked to /etc/haproxy/haproxy.cfg | |
global | |
log /dev/log syslog notice | |
chroot /var/lib/haproxy | |
stats socket /run/haproxy/admin.sock mode 660 level admin | |
user haproxy | |
group haproxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
@contextlib.contextmanager | |
def capture(): | |
"""A context manager to capture stdout and stderr. | |
http://stackoverflow.com/a/10743550/644075 | |
""" | |
import sys | |
from cStringIO import StringIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get total requests by status code | |
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | |
# get top requesters by IP | |
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}' | |
# get top requesters by user agent | |
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | |
# get top requests by URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[buildout] | |
parts += | |
supervisor | |
supervisor-cron | |
[supervisor] | |
recipe = collective.recipe.supervisor | |
plugins = superlance | |
user = admin | |
password = admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# need to change permission access to /etc/varnish/secret | |
[restart] | |
recipe = collective.recipe.template | |
input = inline: | |
#!/bin/bash | |
for i in {1..4} | |
do | |
varnishadm backend.set_health instance$i sick | |
${buildout:bin-directory}/supervisorctl restart app:instance$i |
NewerOlder