Skip to content

Instantly share code, notes, and snippets.

View Daemoen's full-sized avatar

Marc Mercer Daemoen

View GitHub Profile
@Daemoen
Daemoen / logsort.py
Last active January 16, 2020 00:12
Log Sorter
#!/usr/bin/python3
# Given the Apache log file, write a script that returns a list sorted by the most frequently seen (originating) IP addresses with three fields:
#ip
#number of occurrences
#percentage of total requests logged.
#Apache log format is as follows:
#LogFormat "%v:%p %h[%{X-Forwarded-For}i] %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined_with_proxy
import re
@Daemoen
Daemoen / example.ini
Created May 8, 2019 23:50
Ansible static inventory (ini)
[example1]
example1.com service=example1
example1.subdomain.com
@Daemoen
Daemoen / calibre_solarized_light.css
Created February 13, 2019 06:43
Calibre Solarized Light
@import url(http://fonts.googleapis.com/css?family=Inconsolata);
@import url(http://fonts.googleapis.com/css?family=PT+Sans);
@import url(http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700);
article,
aside,
details,
figcaption,
figure,
footer,
header,
@Daemoen
Daemoen / breakit.sh
Created February 8, 2019 00:20
Nightmare Scenario
sudo chmod -rx -R /dev
sudo chattr +i -R /
sudo chmod go+wx -R /home
sudo echo "Enjoy the pain!|wall"
sudo reboot now
@Daemoen
Daemoen / subnet.yml
Created December 8, 2018 00:37
Fully dynamic network design
---
# tasks file for role_network_architecture
- name: Create AWS network subnets in defined azs
block:
- name: Test design of network topology
debug:
msg: "
name: {{ item.1.name }}-{{ item.3.key }}-{{ item.2 }}
cidr_block: {{ item.3.value|regex_replace('xxx', (item.1.basenet + item.1.region_basenet[item.2])|string ) }} # This will extend
# to use the other
@Daemoen
Daemoen / subelement.yml
Created December 8, 2018 00:23
subelement?
---
proviver_subnet_map:
- name: aws
region_azs:
- us-east-1:
- a
- c
- us-east-2:
- a
- d
@Daemoen
Daemoen / vars.yml
Created December 6, 2018 01:09
new stumped issue
provider_network_map:
aws:
basenet: 50
region_basenet:
us-east-1: 0
us-east-2: 1
us-west-1: 2
regions:
us-east-1:
- a
@Daemoen
Daemoen / example_dataset
Last active December 5, 2018 22:23
Stumped
"example_dataset": [
{
"curr_Name": "aws-example-vpca",
"curr_block": "172.123.48.0/20",
"curr_id": "vpc-05978ed5a4",
"curr_region": "us-east-1"
},
{
"curr_Name": "aws-example-vpcb",
"curr_block": "172.123.64.0/20",
@Daemoen
Daemoen / example.yml
Created November 29, 2018 20:46
Strange design choice
- apt:
name: "{{ item }}"
loop: "{{ somelist }}"
somelist:
- a
- b
- c
- apt:
@Daemoen
Daemoen / example.yml
Created November 2, 2018 19:10
Simplify the steps
---
- name: Collect facts about deployed api-gateway
command: "aws apigateway --profile {{ aws_profile }} --region {{ region }} get-rest-apis"
register: get_apis