Skip to content

Instantly share code, notes, and snippets.

@lflfm
lflfm / async_testing.py
Last active May 2, 2023 18:09
Issue testing async method calls
# This gist is for a stack overflow question regarding the testing of the calls to async methods
#####################################
# Implementation to be tested
import asyncio
import json
import unittest
from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch
from uuid import uuid4
@lflfm
lflfm / example.yml
Created October 18, 2022 08:04 — forked from cecilemuller/example.yml
Run Docker Compose + in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@lflfm
lflfm / git_surgery.md
Created September 7, 2022 15:33 — forked from fsmv/git_surgery.md
How to merge multiple git repos into one repo, and preserve history

Merging multiple git repos into one

tl;dr:

  1. Import other repos as branches
  2. Move the files in the other repos into subdirectories for each project
  3. Rebase the other repo branches onto the master
  4. Merge everything into master in order

Note: placeholders are in angle brackets.

@lflfm
lflfm / .bash_profile
Created April 8, 2022 13:31
Bash auto-complete (SSH, git, etc)
#~/.bash_profile
for f in /etc/bash_completion.d/*; do source $f; done

Subtree merges

This is an alternative to submodules:

This gives us a way to have a workflow somewhat similar to the submodule workflow without using submodules (which we will cover in Submodules). We can keep branches with other related projects in our repository and subtree merge them into our project occasionally. It is nice in some ways, for example all the code is committed to a single place. However, it has other drawbacks in that it’s a bit more complex and easier to make mistakes in reintegrating changes or accidentally pushing a branch into an unrelated repository.

Say you want to merge repository a into b. This can be accomplished with one command:

git subtree add --prefix=a ../a master
@lflfm
lflfm / Sequelize Express Starter Guide.md
Last active May 12, 2021 16:22 — forked from clonn/README.md
Sequelize + Express + Migrations + Seed Starter
@lflfm
lflfm / git_flow.md
Last active September 2, 2020 07:54
Pretty safe and solid git flow

new user story, based on dev branch

source

  1. (any_branch) git checkout dev
  2. (dev) git pull
  3. (dev) git checkout -b USxxx_descr #create new branch for the US ...
  4. do your changes
  5. (USxxx_descr) git add (file) (file) (etc...) or git add --all
  6. (USxxx_descr) git status check that everything is correct (only files you really want to change are added)
@lflfm
lflfm / nginx-ssl-config
Created June 22, 2020 13:16 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@lflfm
lflfm / gist:7012bf736c0eeefaa5c3286a710e7e97
Created October 7, 2018 00:19 — forked from monsur/gist:706839
Parses the response from XmlHttpRequest.getAllResponseHeaders() into a key/value pair.
/**
* XmlHttpRequest's getAllResponseHeaders() method returns a string of response
* headers according to the format described here:
* http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method
* This method parses that string into a user-friendly key/value pair object.
*/
function parseResponseHeaders(headerStr) {
var headers = {};
if (!headerStr) {
return headers;