Skip to content

Instantly share code, notes, and snippets.

View slacksec's full-sized avatar

Jason Huang slacksec

View GitHub Profile
@slacksec
slacksec / setenv.sh
Created July 16, 2018 10:08 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
@slacksec
slacksec / ansible-vault-pass.bash
Created April 3, 2018 05:23 — forked from toke/ansible-vault-pass.bash
Small helper script for usage with ansible-vault and ansible-playbook together with pass https://www.passwordstore.org/ Two implementations: first in bash and anotger one in python, which should be better as the git config hack to get ini files may fail due to incompatibilities in git vs. ansible ini style. The bash version is kept for reference.
#!/usr/bin/env bash
set -e
#
# Written by Thomas Kerpe <toke@toke.de> - Public Domain
#
# Small helper script for usage with ansible-vault and ansible-playbook
# together with [pass](https://www.passwordstore.org/)
#
# Say you have stored the vault-password for the current ansible playbook in pass
@slacksec
slacksec / save-sqs-queue.py
Created January 29, 2018 20:34 — forked from kern/save-sqs-queue.py
Saves all messages from an AWS SQS queue into a folder
import argparse
import boto.sqs
import json
import os
parser = argparse.ArgumentParser(description='Saves all messages from an AWS SQS queue into a folder.')
parser.add_argument(
'-q', '--queue', dest='queue', type=str, required=True,
help='The name of the AWS SQS queue to save.')
@slacksec
slacksec / clean_sqs.py
Created November 8, 2017 01:57 — forked from alexmojaki/clean_sqs.py
Clean out old SQS queues
"""
This script iterates through all your SQS queues (based on your default
AWS credentials), shows you a few helpful attributes, and asks if you want
to delete it. It's meant as an easy way to clean out old queues that are
no longer needed.
Requires boto3 (pip install boto3).
The names of queues are derived from their URLs which are assumed to have
a common prefix: replace the 12345 in the URL below. If you don't know what
var utils = require('../lib/utils.js');
var ORIENTATION = {north: 'vertical', east: 'horizontal', south: 'vertical', west: 'horizontal'};
var redplayer = {
info: {
name: 'redplayer',
style: 3
},
ai: function(playerState, enemiesStates, gameEnvironment) {
var response;
@slacksec
slacksec / nginx.conf
Created October 8, 2017 19:53 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@slacksec
slacksec / AWS_Single_LetsEncrypt.yaml
Last active September 26, 2017 01:16 — forked from tony-gutierrez/AWS_Single_LetsEncrypt.yaml
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx. http://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
@slacksec
slacksec / _aws_golang_examples.md
Created August 20, 2017 22:00 — forked from eferro/_aws_golang_examples.md
golang aws: examples

AWS Golang SDK examples

@slacksec
slacksec / ansible-summary.md
Created July 23, 2017 22:49 — forked from AdamOssenford/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of