Skip to content

Instantly share code, notes, and snippets.

View dsl2022's full-sized avatar
🏠
Working from home

DSL dsl2022

🏠
Working from home
View GitHub Profile
@dsl2022
dsl2022 / get-json-secret.sh
Created February 15, 2023 14:11 — forked from atheiman/get-json-secret.sh
Load JSON secret from AWS Secrets Manager using AWS CLI and jq
# Load the field 'Password' from the secret 'test/MySecret' from an AWS Secrets Manager secret
PASSWORD="$(aws secretsmanager get-secret-value --secret-id 'test/MySecret' --query 'SecretString' --output text | jq -r '.Password')"
echo "The password is '$PASSWORD'"
# The password is 'MyP@55w0rd'
@dsl2022
dsl2022 / get-json-secret.sh
Created February 15, 2023 14:11 — forked from atheiman/get-json-secret.sh
Load JSON secret from AWS Secrets Manager using AWS CLI and jq
# Load the field 'Password' from the secret 'test/MySecret' from an AWS Secrets Manager secret
PASSWORD="$(aws secretsmanager get-secret-value --secret-id 'test/MySecret' --query 'SecretString' --output text | jq -r '.Password')"
echo "The password is '$PASSWORD'"
# The password is 'MyP@55w0rd'
@dsl2022
dsl2022 / algorithm_complexity.ipynb
Created January 22, 2023 17:18 — forked from Jessime/algorithm_complexity.ipynb
Algorithm Complexity in the Jupyter Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dsl2022
dsl2022 / KeyPressEvent.js
Created January 28, 2022 05:42 — forked from newvertex/KeyPressEvent.js
Example: Detect keypress event in Node.js console app
var readline = require('readline');
readline.emitKeypressEvents(process.stdin);
if (process.stdin.isTTY)
process.stdin.setRawMode(true);
process.stdin.on('keypress', (chunk, key) => {
if (key && key.name == 'q')
process.exit();
@dsl2022
dsl2022 / markdown-details-collapsible.md
Created December 30, 2021 21:00 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@dsl2022
dsl2022 / 1.srp.py
Created September 12, 2021 15:21
SOLID Principles explained in Python with examples.
"""
Single Responsibility Principle
β€œβ€¦You had one jobβ€β€Šβ€”β€ŠLoki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
"""
class Animal:
def __init__(self, name: str):
@dsl2022
dsl2022 / install-docker.md
Created November 19, 2020 05:09 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@dsl2022
dsl2022 / node_nginx_ssl.md
Created November 13, 2020 05:14 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@dsl2022
dsl2022 / go-stdlib-interface-selected.md
Created November 8, 2020 05:27 — forked from asukakenji/go-stdlib-interface-selected.md
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@dsl2022
dsl2022 / _tree
Created November 5, 2020 12:26 — forked from alexedwards/_tree
.
β”œβ”€β”€ books
β”‚Β Β  β”œβ”€β”€ handlers.go
β”‚Β Β  └── models.go
β”œβ”€β”€ config
β”‚Β Β  └── db.go
└── main.go