Skip to content

Instantly share code, notes, and snippets.

View Ashex's full-sized avatar

Evelyn Osman Ashex

View GitHub Profile
import argparse
import requests
import json
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'token', type=str, help='Bearer token, grab it from the browser or something idk')
parser.add_argument(
import requests
from will.plugin import WillPlugin
from will.decorators import respond_to, require_settings
class WillTestPlugin(WillPlugin):
def get_user_id(self, user_id):
people_cache = self.load('slack_people_cache', {})
for k, c in people_cache.items():
if user_id == c.handle:
@Ashex
Ashex / pyopenssl_ocsp.py
Created August 7, 2018 10:33
Technically this allows you to obtain an OCSP response but pyopenssl doesn't support HTTP OCSP URIs so this is junk but it's worth keeping around.
# Based off this https://stackoverflow.com/a/51108279
# A LOT of SSL Voodoo is happening here
# Other refs: https://github.com/pyca/pyopenssl/issues/168
def verify_ocsp(self):
ocsp_uri = self.get_ocsp_uri(self.x509_certificate)
# We declare we want to use SSL v2/v3 for the context
# but then turn around and disable those two. This results in being able
# to negotiate any protocol that is NOT SSL v2/v3
ssl_context = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv23_METHOD)
{
"author": "Bob Saggett",
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
@Ashex
Ashex / Debug log
Created January 2, 2018 17:19
Crash log for terraform aws_eip
2018/01/02 18:10:51 [INFO] Terraform version: 0.11.1 a42fdb08a43c7fabb8898fe8c286b793bbaa4835+CHANGES
2018/01/02 18:10:51 [INFO] Go runtime version: go1.9
2018/01/02 18:10:51 [INFO] CLI args: []string{"/Users/ahmed/bin/terraform", "plan"}
2018/01/02 18:10:51 [DEBUG] Attempting to open CLI config file: /Users/ahmed/.terraformrc
2018/01/02 18:10:51 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/01/02 18:10:51 [INFO] CLI command args: []string{"plan"}
2018/01/02 18:10:51 [INFO] command: empty terraform config, returning nil
2018/01/02 18:10:51 [DEBUG] command: no data state file found for backend config
2018/01/02 18:10:51 [DEBUG] New state was assigned lineage "82228462-361a-4c13-984b-669ca0f06e3d"
2018/01/02 18:10:51 [INFO] command: backend initialized: <nil>
@Ashex
Ashex / gist:7db8effec89512c149ec121786af823a
Created December 7, 2017 18:37
Pass all videos found under a directory with Handbrake
find /videos -name "*.mkv" -exec bash -c '~/temp/HandBrake-1.0.7/build/HandBrakeCLI -Z "Android 576p25" --input "{}" --output "/out/$(basename {}).mp4" --two-pass --turbo' \
__author__ = 'ahmed'
import boto3, argparse, yaml
from time import sleep
import os.path
def tag_instances(awsTags):
reservations = ec2Client.describe_instances()
import json
from botocore.exceptions import ClientError
import boto3
import sys
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from zabbix.api import ZabbixAPI
@Ashex
Ashex / change_api_keys.sh
Last active July 20, 2016 18:39
Bash function that will replace a value in a json file based off a variable matching a pattern. Useful for docker containers.
change_api_keys ()
{
# Change the API keys in credentials.json
# If a variable with the value is provided
for VAR in `env`
do
case "$VAR" in
POKEMON_* )
key_name=`echo "$VAR" | sed -e "s/^POKEMON_\(.*\)\=.*/\1/"`
echo "Changing value of " $key_name
include auditd
require auditd
auditd::rule { 'check for 64bit time adjustment syscalls':
content => '-a always,exit -F arch=b64 -S adjtimex -S settimeofday -k time-change',
order => 01,
}
auditd::rule { 'check for 32bit time adjustment syscalls':
content => '-a always,exit -F arch=b32 -S adjtimex -S settimeofday -S stime -k time-change',