Skip to content

Instantly share code, notes, and snippets.

View Lydon-01's full-sized avatar

Lydon Lydon-01

  • Cape Town, South Africa
View GitHub Profile
@Lydon-01
Lydon-01 / rename_table.py
Created February 21, 2019 05:12 — forked from dan-hook/rename_table.py
"Rename" an AWS Glue table by creating a new table
import boto3
database_name = "databse"
table_name = "prefix-dir_name"
new_table_name = "more_awesome_name"
client = boto3.client("glue")
response = client.get_table(DatabaseName=database_name, Name=table_name)
table_input = response["Table"]
table_input["Name"] = new_table_name
@Lydon-01
Lydon-01 / GlueLastJobDuration.py
Created October 30, 2018 13:17
Script to get a specific AWS Glue Job and tell you the duration of the last run.
## Python 2.7
## GlueLastRunDuration.py
## Version 1
## by Lydon Carter October 2018
## USE
# Script to get a specific AWS Glue Job and tell you the duration of
# the last run.
# Notes:
# -- The script will use the location you setup for your Glue Context in the "Needed stuff"
@Lydon-01
Lydon-01 / java
Last active November 21, 2017 07:44
Roll the dice, roll again if the same, otherwise return the total.
/* THIS IS BROKEN, NEEDS TO BE FIXED
* This question is taken from Udacity Lesson 4, Problem Set Question 8
*/
public class hello{
public static void main(String[] args){
roll();
System.out.println(monopolyRoll());
}
@Lydon-01
Lydon-01 / java
Created November 18, 2017 05:59
Find the smallest value in the parameter array, and find the largest value, and return the largest value minus the smallest value. If the array has length 0, return -1.
/*
* find the biggest and smallest
*/
public int findRange(int[] intArray) {
if(intArray.length == 0){ //check that the array is bigger than 0
return -1;
}
int largest = intArray[0];
int smallest = intArray[0];
for (int x=1;x<intArray.length;x++){ // find the smallest
@Lydon-01
Lydon-01 / java
Created November 18, 2017 04:55
Years before savings reaches 1million
public int yearsTilOneMillion(double initialBalance) {
int year = 1;
double savings = initialBalance;
while (savings < 1000000){
savings = savings * 1.05;
year++;
}
return year;
}