Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar
💭
🍒 🍍 🍓 🍊 🍌

Chaz Reid charlesreid1

💭
🍒 🍍 🍓 🍊 🍌
View GitHub Profile
@charlesreid1
charlesreid1 / doit.sh
Last active March 28, 2024 06:07
Download the Large-scale CelebFaces Attributes (CelebA) Dataset from their Google Drive link
#!/bin/bash
#
# Download the Large-scale CelebFaces Attributes (CelebA) Dataset
# from their Google Drive link.
#
# CelebA: http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html
#
# Google Drive: https://drive.google.com/drive/folders/0B7EVK8r0v71pWEZsZE9oNnFzTm8
python3 get_drive_file.py 0B7EVK8r0v71pZjFTYXZWM3FlRnM celebA.zip
@charlesreid1
charlesreid1 / gist:28299e1977c832b163e3
Last active March 24, 2023 05:51
Gist illustrating how to connect to a GE Proficy iHistorian OLEDB instance from Python. This uses the PyADO library (http://pyado.sourceforge.net).
import PyADO
#print help(PyADO.connect)
conn = PyADO.connect(None,host='localhost',user='',password='',provider='iHOLEDB.iHistorian.1')
print conn
curs = conn.cursor()
curs.execute("SELECT * FROM ihTags")
@charlesreid1
charlesreid1 / allstars.py
Last active May 2, 2022 06:34
quick-n-dirty script to get a list of all starred Github repos for a given user using Python and PyGithub
from github import *
import sys
import json
def usage():
print("")
print("allstars.py: script to print all repos starred by a Github user")
print("Usage: python allstars.py [USERNAME]")
print("")
@charlesreid1
charlesreid1 / process.py
Last active January 15, 2022 19:45
Example Jinja template for yaml config files
from jinja2 import Environment, PackageLoader, select_autoescape
def process(**kwargs):
# set up Jinja env
env = Environment(
loader=PackageLoader(''),
autoescape=select_autoescape(['html', 'xml'])
)
@charlesreid1
charlesreid1 / zappa_iam_policy.md
Last active October 16, 2021 16:52
Zappa IAM policy

By default, zappa has an extremely insecure and hand-wavey approach to permissions, which is to

This gist contains an IAM policy document that can be attached to a role, and/or to an IAM user, that will allow the IAM user to perform all of the ncessary actions required to deploy a zappa function.

Via Cisco: https://github.com/CiscoSecurity/tr-05-serverless-microsoft-defender-for-endpoint/blob/3d9248a06ff287db23a06e88296a5d3fa6713ab4/aws/ZappaLambdaDeploymentPolicy.json

More info: https://github.com/CiscoSecurity/tr-05-serverless-microsoft-defender-for-endpoint/blob/3d9248a06ff287db23a06e88296a5d3fa6713ab4/aws/HOWTO.md#sample-aws-iam-policy-for-deployment-zappalambdadeploymentpolicy

@charlesreid1
charlesreid1 / zappa_deployer.json
Created October 16, 2021 01:13 — forked from caseydm/zappa_deployer.json
Zappa IAM Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PutRolePolicy"
],
"Resource": [
@charlesreid1
charlesreid1 / NQueens.java
Last active October 1, 2021 22:50
Solving the N queens problem using Java. Implementing a verb-based approach utilizing fast built-in data structures.
import java.util.LinkedList;
import java.util.Arrays;
public class NQueens {
public static final int SIZE = 11;
///////////////////////////////////////////////////
// main
//
@charlesreid1
charlesreid1 / Directory.java
Last active August 31, 2021 08:44
Recursion: Directory Crawl Example with Java
import java.io.*;
public class Directory {
private static void crawl(File f, int indent) {
// Always print the name of the File object, with appropriate indentation
for(int i=0; i<4*indent; i++) {
System.out.print(" ");
}
System.out.println(f.getName());
@charlesreid1
charlesreid1 / blaseball_divisions.json
Created September 1, 2020 07:47
Blaseball team division and league information in JSON format
{
"Lawful Good": [
"Lovers",
"Tacos",
"Steaks",
"Breath Mints",
"Firefighters"
],
"Chaotic Good": [
"Shoe Thieves",
@charlesreid1
charlesreid1 / decorators_examples.py
Last active October 23, 2019 15:43
Examples of Python decorators in action
import random
"""
Python Decorators: Some Examples
This file contains a few examples of ways you can
use decorators. These are minimal examples that
should generalize usefully in many situations.
Also see: https://wiki.python.org/moin/PythonDecoratorLibrary