Skip to content

Instantly share code, notes, and snippets.

View cmaggiulli's full-sized avatar

Chris Maggiulli cmaggiulli

View GitHub Profile
@cmaggiulli
cmaggiulli / canvas_data_dap_custom_download_names.py
Created February 10, 2024 21:35 — forked from hanleybrand/canvas_data_dap_custom_download_names.py
Importing instructure-dap-client and using it programatically - quickstart example scripts
import os
from pathlib import Path
import shutil
from urllib.parse import urlparse
from dap.api import DAPClient
from dap.dap_types import Format, IncrementalQuery, SnapshotQuery
import requests
output_dir_base = Path("downloads")
@cmaggiulli
cmaggiulli / Jenkinsfile
Last active December 2, 2023 19:52
A groovy script that will dump all Google BigQuery data to JSON files on the system local to the process
pipeline {
agent any
environment {
CREDENTIALS_PATH = './fake-credentials.json'
GCS_BUCKET = 'fake-bucket-name'
PROJECT_ID = 'fakeprojectid-131113'
DESTINATION_PATH = './'
}
#!/bin/bash
# This script will dump all smartCampaign data from Marketo into a
# semantically valid JSON file for consumption by downstream processes
# Author : Chris Maggiulli ( cmaggiulli@gmail.com )
echo "Script Start Time $(date)"
# Set script parameters
grant_type="client_credentials"
@cmaggiulli
cmaggiulli / README.md
Created November 16, 2022 01:43 — forked from magnetikonline/README.md
NSSM - the Non-Sucking Service Manager cheatsheet.
@cmaggiulli
cmaggiulli / README.md
Created November 16, 2022 01:43 — forked from magnetikonline/README.md
NSSM - the Non-Sucking Service Manager cheatsheet.
@cmaggiulli
cmaggiulli / boto_session.py
Created October 2, 2022 01:06 — forked from pritul95/boto_session.py
Refreshable Boto3 Session to create auto refreshable client or resource
from uuid import uuid4
from datetime import datetime
from time import time
import boto3
from boto3 import Session
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
@cmaggiulli
cmaggiulli / git-cherry-pick.txt
Created September 20, 2022 16:31 — forked from ViktorAndonov/git-cherry-pick.txt
How to cherry pick commits
0.1) Use the terminal;
1) Make sure there is no changes in both branches (git status);
2) Checkout the brach that you want to take the commit from;
3) Use git log to show the full number of the commit that you want to cherry pick, and copy it from the teminal;
4) Now checkout the branch that you want to recive;
5) Then write: git cherry-pick [the number of the commit that you want to take, without brackets]
6) You are done! or if conflicts appear resolve them manually;
7) Then commit the changes;
@cmaggiulli
cmaggiulli / Whitelist22.tf
Created September 20, 2022 00:19
Terraform Whitelist Port 22
resource "aws_security_group" "jobs-worker-test" {
name = "jobs-worker-test"
description = "jobs-worker-test"
vpc_id = data.aws_vpc.core_vpc.id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
security_groups = [aws_security_group.jobs-container.id]
}
@cmaggiulli
cmaggiulli / RunECR.tf
Created September 20, 2022 00:17
Run ECR Command from Terraform
resource "null_resource" "run_task" {
count = var.run_task == "YES" ? 1 : 0
triggers = {
timestamp = timestamp()
}
provisioner "local-exec" {
command = "aws ecs run-task --task-definition appdev-deactivate-canvas-enrollments-${terraform.workspace} --cluster ${data.aws_ecs_cluster.ecs_cluster.cluster_name} --network-configuration \"awsvpcConfiguration={subnets=[${join(",", data.aws_subnet_ids.subnets.ids)}],securityGroups=[${join(",", concat(data.aws_security_groups.default-container-sg.ids, data.aws_security_groups.mail-sg.ids, data.aws_security_groups.db-sg.ids, data.aws_security_groups.allow-443-outbound-sg.ids))}],assignPublicIp=DISABLED}\" --launch-type FARGATE --region us-east-1"
}
}
@cmaggiulli
cmaggiulli / CalculateAverageRuntime
Last active September 20, 2022 00:11
A variety of Jenkins Groovy Script Console scripts for administering Jenkins
def job = Hudson.instance.getJob('job-name')
def cardinality = job.builds.size()
def summation = job.builds*.duration.sum()
print( ( ( summation/cardinality/1000 as double ) ).round(1) )