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 zipfile | |
import io | |
import requests | |
def load_dataframe_from_http_zip_csv_file(endpoint, csv_filename, engine='python', encoding='ISO-8859-1', delimiter=';', skiprows=0, index_col=None): | |
response = requests.get(endpoint) | |
zip_data = zipfile.ZipFile(io.BytesIO(response.content)) | |
zip_data.extract(csv_filename, path='extracted_directory') | |
df = pd.read_csv(f'extracted_directory/{csv_filename}', encoding=encoding, delimiter=delimiter, engine=engine, skiprows=skiprows, index_col=index_col) | |
return df |
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
# list users from a cognito specific poll | |
aws cognito-idp list-users --user-pool-id us-east-1_aaaaa > users.txt | |
# awk script save to script_parse_users.awk | |
# run the script printing "username,id" csv like | |
awk -f script_parse_users.awk users.txt | |
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
//http://www.hacksparrow.com/base64-encoding-decoding-in-node-js.html | |
var fs = require('fs'); | |
// function to encode file data to base64 encoded string | |
function base64_encode(file) { | |
// read binary data | |
var bitmap = fs.readFileSync(file); | |
// convert binary data to base64 encoded string | |
return new Buffer(bitmap).toString('base64'); | |
} |
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
// Get classloader libs | |
ClassLoader tcl = Thread.currentThread().getContextClassLoader(); | |
Enumeration<URL> roots = tcl.getResources(""); | |
for(;roots.hasMoreElements();){ | |
URL url = roots.nextElement(); | |
System.out.println("URL: " + url.getPath()); | |
} | |