Skip to content

Instantly share code, notes, and snippets.

ACCOUNT=X
REGION="us-east-1"
FUNCTION1_NAME="zabbix-deregister"
FUNCTION2_NAME="zabbix-register"
ASSUMEROLE_POLICY=$(python -c "import json; print json.dumps(
{ 'Version': '2012-10-17',
'Statement': [{ 'Sid': '',
'Effect': 'Allow',
'Principal': {'Service': 'lambda.amazonaws.com'},
@silviud
silviud / jmxremote_arguments.sh
Created September 2, 2016 12:27 — forked from rponte/jmxremote_arguments.sh
Arguments to enable JMX on JVM - Example of setenv.sh file
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
@silviud
silviud / demo.pt
Created July 13, 2016 01:30
Chameleon string template
from chameleon.zpt.template import PageTemplate
template = PageTemplate(
"""
<div xmlns="http://www.w3.org/1999/xhtml">
Hello World!
</div>
<p tal:content="user_message">
Designer sees this.
</p>
"""
# imports python modules from an abs path
def _imp(filename):
import imp
import os
path, name = os.path.split(filename)
name, ext = os.path.splitext(name)
file, filename, data = imp.find_module(name, [path])
mod = imp.load_module(name, file, filename, data)
return mod
from flask import Flask
from flask_hmacauth import (
hmac_auth,
DictAccountBroker,
HmacManager
)
app = Flask(__name__)
import requests
import time
import hashlib
import sys
import hmac
import logging
try: # for Python 3
from http.client import HTTPConnection
except ImportError:
@silviud
silviud / init.sls
Created May 25, 2016 01:12 — forked from BrandKNY/init.sls
SaltStack Reactor-Orchestration-State example workflow using Require statements
# Location: /srv/salt/raidarray/
## notice namespacing at top-level of each block, followed by the module.function
raid-create-array:
cmd.script:
- source: salt://raidarray/create_raid.sh
- cwd: /
- user: root
# here I am calling the pkg module and installed function but it requires first that cmd module ran previously on namespaced
@silviud
silviud / list_ciphers.sh
Created April 5, 2016 23:53
Discovers the ssl ciphers supported by a site
#!/bin/bash
# OpenSSL requires the port number.
SERVER=my_server:443
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
@silviud
silviud / delete_snapshots.py
Created March 30, 2016 00:56 — forked from kjoconnor/delete_snapshots.py
boto script to delete snapshots matching a filter and older than X days
import sys
from boto.ec2 import connect_to_region
from datetime import datetime, timedelta
try:
days = int(sys.argv[1])
except IndexError:
days = 7
@silviud
silviud / configure_proxy_protocol.md
Created March 21, 2016 23:54 — forked from pablitoc/configure_proxy_protocol.md
Configuring Proxy Protocol

##Install AWS CLI Tools##

  1. Install AWS CLI Tools. You can also use the EC2 API Tool if you are more comfortable with them. But this write-up uses the EC2 CLI.
  2. Create a user via Amazon IAM or download the security accessID and securitykey you will need it to query Amazon CLI.
  3. using Terminal cd into .aws directory cd ~/.aws edit or create new file named config paste the following contents inside.
    `[default]`
    `aws_access_key_id = ACCESS_ID`
    `aws_secret_access_key = SECRET_ID`
    `output = json OR bson OR text`
    `region = PREFERRED_AWS_REGION`

Save the file as "config"