Skip to content

Instantly share code, notes, and snippets.

View eddiecorrigall's full-sized avatar

Eddie Corrigall eddiecorrigall

View GitHub Profile
@eddiecorrigall
eddiecorrigall / git-packfiles.md
Last active August 5, 2021 14:47
Git Packfiles

I am sure some of you, like me, have cloned a repository and experienced the long wait time to copy data locally with a fast computer and fast internet. The repository might have large Git packfiles .git/objects/pack which surpass 1G in size. Digging a little deeper, you might find that this might be caused by blob files: assets in the repository. While not necessarily a bad thing, some of these files might be better off in another repository, since they do not appear necessary to run or deploy the app.

In the meanwhile, to save a little time, you can always shallow copy (0m49.415s on my computer):

# Shallow clone staging
git clone \
@eddiecorrigall
eddiecorrigall / chunker.bash
Created July 27, 2021 15:13
A command line tool to partition files by row
#!/bin/bash
set -e
SCRIPT="$0"
function usage() {
echo "USAGE: ${SCRIPT} <FILE> [CHUNK] [CHUNK_SIZE]"
echo -e "\t Use this script to partition a file by row."
echo -e "\t FILE - (required) a file path read in for partitioning."
@eddiecorrigall
eddiecorrigall / flask-forms.md
Last active May 6, 2021 13:35
Using WTForms in a Flask project without Flask-WTF

This is a code snippet demonstrating using WTForms without Flask-WTF in a Flask project.

I found the extension: Flask-WTF problematic. So I decided to limit the number of dependencies and take control of this part of the project.

First define a base form to get the following features:

  • (csrf) cross-site request forgery protection
  • convenience method validate_on_submit()
@eddiecorrigall
eddiecorrigall / post-scrum.md
Created July 2, 2020 14:08
Post-scrum Template

Post-Scrum template

Use a spreadsheet to store daily discussion: decisions, news, product and technical information. Having a post-scrum ensures that the team does not need to be available for the entire update. It also helps capture context when the team makes decisions and keeps team up to date.

Recommendations:

  • insert new entries at top, it will make it easy to load each morning when there are many entries
  • make a new post-scrum sheet each quarter, again to improve navigation and organization

Fields

@eddiecorrigall
eddiecorrigall / how-i-passed-my-aws-exam.md
Last active September 12, 2023 14:24
How I passed my AWS exam

How I Passed My AWS Exam

I passed my exam, you can too. The grade you need to pass is not known, and changes per exam and region taken. You should aim for a minimum of 70%.

AWS Certified Developer Associate

This is the easiest of the associate level exams, but that is not to say that everyone will pass. Its a lot of material, and you will need time for it to soak in. You can do it!

@eddiecorrigall
eddiecorrigall / http_sessions.md
Last active September 12, 2023 14:20
Http Server Sessions

HTTP Sessions

As an introduction, lets find out what it means to be stateless and stateful protocol. Then lets dive into how using cookies helps us maintain a server-side session, and finally lets talk about security.

Stateless HTTP

Originally HTTP began as a stateless protocol, which will not assume any special meaning between requests even if they originate from the same socket. While this is great for serving content, it only offers a generic user experience as the server is unable to distinguish between users natively.

Stateful HTTP

With stateful protocol, the user state is persisted between requests so the server will be able to build context. For example, server would then be able to answer: Who are they? Are they authenticated? What items do they have in their chart? In constrast, a stateless protocol would handle each request as if it had seen it for the first time.

How cookies are set

@eddiecorrigall
eddiecorrigall / jenkins_build_skip.md
Last active April 8, 2022 10:01
Jenkins: Build only when necessary

Build Only When Necessary

In testing environments, it is not always useful repeating tasks which can cost developers valuable time. Within a project its safe to assume that not all files are changed, so why rebuild?

This tutorial outlines a method to reduce unnecessarly build steps. Use your best judgement of course. It might be useful to add in a build on occassion to ensure third party dependencies are available and will not disrupt a production deployment.

Jenkins Setup

The git plugin in Jenkins provides several useful environment variables which can be used to avoid build tasks. Make sure you setup the git plugin before going any further.

@eddiecorrigall
eddiecorrigall / open_jira.html
Created June 27, 2018 13:51
Bookmark this code, and use it to open a JIRA ticket
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<script>
var defaultProject = 'LPM';
// Attempt to get selected text in window
var ticket = null;
// Otherwise attempt to prompt user for ticket
while (!ticket) {
@eddiecorrigall
eddiecorrigall / reverting_db_migration.md
Created April 16, 2018 15:43
Reverting a Database Migration

Reverting a Database Migration

Integration (CI) is always rebuilt from scratch. Changeset updates can easily be reverted just by updating the branch.

Release candidate (RC) however, is never built from scratch. This is because the RDS persists data that is vital to integration tests used by other teams. Unfortunately this difference makes it difficult to rollback migrations already applied to RC.

This article describes two strategies to rollback a migration from RC.

Changeset Migration has Changed

@eddiecorrigall
eddiecorrigall / branch_per_feature.md
Last active June 18, 2024 14:04
Branch per Feature Strategy

Introduction

Authors: Kevin Hankens, Richard Burford, Balazs Nagykekesi, Eddie Corrigall

Our build process is based on the Branch-per-Feature (BPF) strategy.

BPF allows us to work concurrently through the iteration on different tasks and merge them just before the release. Each segment of work requires a separate branch, named after the JIRA task that describes the story. The main benefit of this strategy is that we gain a convenient way to track changes and build a release with only the features that are finished i.e. we don't have to do anything special to pull a story from the release, we can simply rebuild the release candidate with only the branches we require.

Unfortunately, merge conflicts are a regular burden with this workflow. Inevitably, we touch the same lines of code in separate feature branches and a simple git merge is not adequate to resolve the conflicts. We use the git rerere method to solve this. Git save