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
# Copyright 2014 Dan Krause | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 -*- | |
"""A simple tool to document how to control AWS resources. | |
AWS AUTHENTICATION | |
------------------- | |
In order to run any of the code below, you need a profile with AWS credentials | |
set up on your computer. It's very easy to do this. Google how to configure | |
your profile with boto3, or visit the docs: |
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
# run as root or sudo everything below | |
# install epel | |
amazon-linux-extras install epel -y | |
# install fail2ban | |
yum -y install fail2ban | |
# configure fail2ban (just adding enabled=true in the sshd section) | |
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local |
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
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function deleteAllMails(){ | |
for (var i = 0;i<100;i++){ | |
setTimeout(function(){document.getElementById("selectAll").click()},1000); | |
setTimeout(function(){document.getElementsByClassName("moveElement-btn-delete")[0].click()},3000); | |
setTimeout(function(){document.getElementById("confirmModalBtn").click()},5000); | |
await sleep(10000) |
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
sqlite3 gravity.db.backup -header -csv 'select * from adlist' > adlist.csv | |
sqlite3 gravity.db.backup -header -csv 'select * from vw_whitelist' > whitelist.csv | |
sqlite3 gravity.db.backup -header -csv 'select * from vw_blacklist' > blacklist.csv |
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 discord | |
from discord.ext import commands | |
import datetime | |
from urllib import parse, request | |
import re | |
bot = commands.Bot(command_prefix='>', description="This is a Helper Bot") | |
@bot.command() |
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 boto3 | |
from datetime import datetime, timezone | |
from functools import reduce | |
import operator | |
ec2 = boto3.client('ec2') | |
cloudtrail = boto3.client('cloudtrail') | |
def get_events(instanceid): | |
response = cloudtrail.lookup_events ( |
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
#!/bin/sh | |
# For debugging use iptables -v. | |
IPTABLES="/sbin/iptables" | |
IP6TABLES="/sbin/ip6tables" | |
MODPROBE="/sbin/modprobe" | |
RMMOD="/sbin/rmmod" | |
ARP="/usr/sbin/arp" | |
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 random | |
# Determinant predicate (line sidedness test) | |
def det3x3_pt(p, q, r): | |
a = (q[0] - p[0], q[1] - p[1]) | |
b = (r[0] - p[0], r[1] - p[1]) | |
return a[0]*b[1] - a[1]*b[0] | |
def convex_hull(points): | |
# sorts points by x then y which works for us (we only need the sort by x part here, but it doesn't hurt) |
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
# iptable command to set DSCP flag on outgoing udp packets | |
iptables -t mangle -A OUTPUT -p udp -j DSCP --set-dscp-class ef |
NewerOlder