Skip to content

Instantly share code, notes, and snippets.

View psenger's full-sized avatar
:octocat:
Makin Bacon

Philip A Senger psenger

:octocat:
Makin Bacon
View GitHub Profile
@psenger
psenger / README.md
Last active November 20, 2023 04:15
[LocaStack Cheat Sheet] #LocaStack #AWS

Localstack Cheat Sheet

Environment

I put everything in us-east-1 so this might not be for you.

export AWS_ACCESS_KEY_ID="test"
export AWS_SECRET_ACCESS_KEY="test"
export AWS_DEFAULT_REGION="us-east-1"
@psenger
psenger / README.md
Last active December 5, 2023 04:24
[The Nullish Coalescing Operator `??` and Logical OR Operator `||`] #JavaScript

The Nullish Coalescing Operator ??and Logical OR Operator ||

value const assign = value ?? 'right' const assign = value || 'right'
null right right
undefined right right
'""' left right
0 left right
[] left left
NaN right right
# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module. Uses the certificates provided by the certifi package:
# https://pypi.python.org/pypi/certifi
import os
import os.path
import ssl
import stat
@psenger
psenger / README.md
Last active October 15, 2023 22:52
[Backup and Recovery of Postgres] #Postgres

Backup and Recovery of Postgres

Backup

pg_dump --dbname=<database_name> \
--inserts \
--format=d \
--create \
--file= \
@psenger
psenger / Clean-up-local-Git.md
Created October 5, 2023 21:14
[Clean Up Local Git] #git

Git Cleanup

Cleanup unnecessary files and optimize the local repository

Runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance), removing unreachable objects which may have been created from prior invocations of git add, packing refs, pruning reflog, rerere metadata or stale working trees. May also update ancillary indexes such as the commit-graph.

When common porcelain operations that create objects are run, they will check whether the repository has grown substantially since the last maintenance, and if so run git gc automatically. See gc.auto below for how to disable this behavior.

Running git gc manually should only be needed when adding objects to a repository without regularly running such porcelain commands, to do a one-off repository optimization, or e.g. to clean up a suboptimal mass-import. See the "PACKFILE OPTIMIZATION" section in git-fast-import(1) for more details on the import case.

@psenger
psenger / Compare-two-branches-to-find-commits-in-one-but-not-the-other.md
Last active October 5, 2023 21:03
[Compare two branches to find commits in one but not the other] #git

Compare two branches to find commits in one but not the other

git-cherry - Find commits yet to be applied to upstream. Essential for rebase and merging.

Patch workflows

git-cherry is frequently used in patch-based workflows (see gitworkflows(7)) to determine if a series of patches has been applied by the upstream maintainer. In such a workflow you might create and send

a topic branch like this:

@psenger
psenger / finding-a-committed-bug-with-Git.md
Last active October 5, 2023 20:57
[Finding a committed bug with Git] #git #git-bisect #bug

Finding a committed bug with Git CLI

git-bisect - Use binary search to find the commit that introduced a bug

Basic bisect commands: start, bad, good

As an example, suppose you are trying to find the commit that broke a feature that was known to work in version v2.6.13-rc2 of your project. You start a bisect session as follows:

@psenger
psenger / README.md
Created August 25, 2023 03:49
[HTML CSS Row Cells with Nice Borders] #HTML #CSS

HTML CSS Row Cells with Nice Borders

I want a row of cells, with nice borders. this kind of works, needs a little more work

<div class="container">
  <div class="cell">Cell 1</div>
  <div class="cell">Cell 2</div>
  <div class="cell">Cell 3</div>
  <!-- Add more cells as needed -->
@psenger
psenger / Readme.md
Last active August 21, 2023 01:32
[With Docker, pull a specific image from local docker, and then push that to a remote registry] #Docker

To pull a specific Docker image from your local machine and then push it to a remote Docker registry, you can follow these steps:

  1. Pull the Image Locally: Open a terminal window and use the docker pull command to pull the specific image you want from your local machine. Replace local-image:tag with the name and tag of the image you want to pull.
docker pull local-image:tag
  1. Tag the Image:
@psenger
psenger / RemoveRairedTags.md
Last active August 19, 2023 04:34
[Regular Expression that will delete a HTML tags, any attributes, and closing tag, leaving everything in the middle intact] #RegEx

Removing "paired" or "container" tags

You can use the following regular expression to remove the <font> tags and their attributes while leaving the multi-line contentinside intact:

<font\b[^>]*>([\s\S]*?)<\/font\s*>

Explanation: