Skip to content

Instantly share code, notes, and snippets.

@unstppbl
unstppbl / go_time_parsing.md
Last active May 7, 2024 22:06
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@blazewicz
blazewicz / pyenv-install.sh
Last active May 7, 2024 22:02
pyenv - Install Python 3.x with optimizations on macOS with macports
#!/bin/bash
set +x
PY_VERSION=3.10.1
export MAKE_OPTS="-j4"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --enable-framework"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --with-computed-gotos"
export PYTHON_CONFIGURE_OPTS="$PYTHON_CONFIGURE_OPTS --with-system-expat"
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 7, 2024 22:01
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@matthewjberger
matthewjberger / instructions.md
Last active May 7, 2024 22:01
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

How to get local administrator on an organisation-owned machine

Important

I am not liable or responsible for any damage caused by attempting this or any punishment by your organisation for bypassing organisation-owned monitoring software. Only use this at your own risk and ensure you have sufficient expertise to perform such a task.

Prerequisites

  • Another machine, running Windows
  • A USB flash drive with at least 8GB of free storage
  • A stable internet connection
  • Ensure USB-A ports are recognized by your machine for hardware other than peripherals (if you have an unlocked BIOS you may have to enable flash storage to be recognized first)
  • Ensure that you are alright with losing all of the information currently on the device; this includes making sure you've backed up any files you deem important.
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active May 7, 2024 22:00
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@wojteklu
wojteklu / clean_code.md
Last active May 7, 2024 22:00
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@thomashartm
thomashartm / aws-sam-colima.md
Last active May 7, 2024 21:58
Enable AWS SAM local to run without Docker Desktop but Colima + Docker Daemon on MacOs

AWS SAM local commands without Docker Desktop

AWS SAM local commands check for the existance of DOCKER_HOST. If the variable is not present, it will fail with the following error message

Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?

Replace it with Colima

Point DOCKER_HOST to unix socket of the Docker Daemon.