Skip to content

Instantly share code, notes, and snippets.

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# .config/youtube-dl/config
# all the metadata (including description, annotations, view/like count, etc) in a nice and parseable format
--write-info-json
# This keeps track of all the videos you have downloaded so they can be skipped over the next time it's ran or the next time it finds that video.
--download-archive "youtube-dl_archive.log"
# Ignore any errors that occur while downloading. Occasionally they will happen and this just ensures things keep moving along as intended. Don't worry, the next time it is ran any videos that didn't fully download will most likely be picked right back up where it left off!
-i
@hmain
hmain / create_confluence_page.py
Created November 20, 2018 15:12
Create a confluence page from python
#!/usr/bin/env python
from jira import JIRA
import argparse
wiki_url = "https://" + server + "wiki/rest/api/content?user=" + email + ":" + apikey
encoded_body = json.dumps(jsonfile)
headers = { 'Content-type': 'application/json', 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' }
http = urllib3.PoolManager()
r = http.request('POST', wiki_url, headers={'Content-Type': 'application/json'}, body=encoded_body )
@hmain
hmain / query_s3_access_logs_with_athena.sql
Created November 10, 2017 16:07
Query S3 Access Logs with AWS Athena
/* Create a database in Athena */
CREATE DATABASE s3_AccessLogsDB;
/*
Create a table within the Athena database
Replace s3://MY_S3_BUCKET/ with your S3 bucket
which has the access logs you want to query
*/
CREATE EXTERNAL TABLE IF NOT EXISTS s3_AccessLogs.Accesslogs(
BucketOwner string,
@hmain
hmain / export-api-gateways.sh
Last active September 22, 2017 09:38
Download AWS Api Gateway swagger json with the AWS cli
#!/bin/bash
REGION="eu-west-1"
ITEMS=$(aws --region eu-west-1 apigateway get-rest-apis | jq -r '.items[] | .id')
STAGE="prod"
for item in $ITEMS
do
aws --region $REGION \
apigateway get-export \
--parameters '{"extensions":"integrations,authorizers"}' \