This file contains hidden or 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
| # http://stuvel.eu/files/python-rsa-doc | |
| # You can `pip install rsa` | |
| import rsa | |
| ### KEY GENERATION ### | |
| ### Run once, on your dev environment | |
| ### Store the private key in a secure place; add the pubkey to your program | |
| (pubkey, privkey) = rsa.newkeys(1024) |
This file contains hidden or 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 java.util.*; | |
| import java.io.*; | |
| import java.security.*; | |
| public class ChangePassword | |
| { | |
| private final static JKS j = new JKS(); | |
| public static void main(String[] args) throws Exception | |
| { |
This file contains hidden or 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 json | |
| import boto | |
| from django.db import models | |
| from django.conf import settings | |
| from django.contrib.auth.models import User | |
| class UploadToken(models.Model): | |
| user = models.ForeignKey(User) | |
| created = models.DateTimeField(auto_now_add=True) |
This file contains hidden or 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
| def verify_sign(public_key_loc, signature, data): | |
| ''' | |
| Verifies with a public key from whom the data came that it was indeed | |
| signed by their private key | |
| param: public_key_loc Path to public key | |
| param: signature String signature to be verified | |
| return: Boolean. True if the signature is valid; False otherwise. | |
| ''' | |
| from Crypto.PublicKey import RSA | |
| from Crypto.Signature import PKCS1_v1_5 |
This file contains hidden or 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/bash | |
| # Here short description of this script | |
| # This is just a template to be used for writing new bash scripts | |
| ### | |
| # Based on Google Style Guide: https://google.github.io/styleguide/shell.xml | |
| # General remarks | |
| # * Executables should have no extension (strongly preferred) or a .sh extension. | |
| # * Libraries must have a .sh extension and should not be executable |
This file contains hidden or 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/bash | |
| # Adapted from original by Jaime Preciado-Beas (jpreciad@nd.edu) | |
| # To export env variables to current shell | |
| # run: . user-mfa.sh | |
| # check for user's mfa serial number | |
| : ${AWS_MFA_SERIAL?"Need to set AWS_MFA_SERIAL. Locate at the bottom of your user page under AWS Console -> Identity and Access Management -> Users -> Your netID. Field is labeled 'Multi-Factor Authentication Device'"} | |
| unset AWS_ACCESS_KEY_ID |
This file contains hidden or 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
| #resides in app/models/connectors/ | |
| class Connectors::Aws | |
| attr_reader :aws_access_key_id, :aws_secret_access_key, :aws_security_token, :expires_at | |
| def initialize | |
| if ENV.has_key?('AWS_SECURITY_TOKEN') #localhost | |
| @aws_access_key_id = ENV['AWS_ACCESS_KEY_ID'] | |
| @aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] | |
| @aws_security_token = ENV['AWS_SECURITY_TOKEN'] | |
| @expires_at = Time.now + 10.hours |
This file contains hidden or 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
| ''' | |
| This script performs efficient concatenation of files stored in S3. Given a | |
| folder, output location, and optional suffix, all files with the given suffix | |
| will be concatenated into one file stored in the output location. | |
| Concatenation is performed within S3 when possible, falling back to local | |
| operations when necessary. | |
| Run `python combineS3Files.py -h` for more info. | |
| ''' |
This file contains hidden or 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 | |
| import logging | |
| import datetime | |
| import re | |
| import time | |
| #setup simple logging for INFO | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.ERROR) |
This file contains hidden or 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 | |
| import logging | |
| #setup simple logging for INFO | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.INFO) | |
| #define the connection | |
| ec2 = boto3.resource('ec2') |
OlderNewer