Skip to content

Instantly share code, notes, and snippets.

:octocat:

Ruan Bekker ruanbekker

:octocat:
Block or report user

Report or block ruanbekker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DaisukeMiyamoto
DaisukeMiyamoto / assume_role.py
Created Sep 12, 2018
AWS Boto3 Assume Role example
View assume_role.py
import boto3
from boto3.session import Session
def assume_role(arn, session_name):
"""aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role"""
client = boto3.client('sts')
account_id = client.get_caller_identity()["Account"]
print(account_id)
@mgaspari
mgaspari / youtube-to-mp3.rb
Created Aug 23, 2017 — forked from stefan-lz/youtube-to-mp3.rb
youtube vids to mp3 files (ruby)
View youtube-to-mp3.rb
#!/usr/bin/ruby
#usage: youtube-to-mp3 <youtube-url>
#example: youtube-to-mp3 http://www.youtube.com/playlist?list=PL398CE05652474A1E
#desc: downloads a single youtube vid or a playlist, then converts to mp3.
# Requires youtube-dl and ffmpeg
url = ARGV[0]
system("youtube-dl -citA #{url}")
@gene1wood
gene1wood / role_arn_to_session.py
Created Dec 29, 2016
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
View role_arn_to_session.py
import boto3
def role_arn_to_session(**args):
"""
Usage :
session = role_arn_to_session(
RoleArn='arn:aws:iam::012345678901:role/example-role',
RoleSessionName='ExampleSessionName')
client = session.client('sqs')
"""
@greyli
greyli / app.py
Created Dec 22, 2016
Photo upload and manage with Flask and Flask-Uploads (Multiple file upload support!).
View app.py
# -*- coding: utf-8 -*-
import os
import time
import hashlib
from flask import Flask, render_template, redirect, url_for, request
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired, FileAllowed
from wtforms import SubmitField
@fgassert
fgassert / ec2-get-security-credentials
Last active Apr 30, 2019
gets iam security credentials from instance metadata and writes them to awscli environment variables and .s3cfg (for s3cmd)
View ec2-get-security-credentials
#!/bin/bash
# gets iam security credentials from instance metadata and writes them to
# awscli environment variables and .s3cfg (for s3cmd)
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION
# ROLE=$1
# DEFAULT_REGION=$2
You can’t perform that action at this time.