Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Define your CIDR block
CIDR_BLOCK="10.0.0.0/16"
# Create VPC and store the VPC ID
VPC_ID=$(aws ec2 create-vpc --cidr-block $CIDR_BLOCK --query 'Vpc.VpcId' --output text)
# Check if VPC_ID is not empty
if [ -z "$VPC_ID" ]; then

#Rob Pike's 5 Rules of Programming

##Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.

##Rule 2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.

##Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)

find . -empty -type d -exec touch {}/.gitkeep \;
@netologist
netologist / clean_code.md
Created November 18, 2022 11:50 — forked from wojteklu/clean_code.md
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

@netologist
netologist / Vault_examples.md
Created November 13, 2022 14:25 — forked from stenio123/Vault_examples.md
Vault Examples

Vault Examples

Examples highligthing different Vault features.

To have a list of valid CLI flags, use

vault -h
vault <FEATURE> -h

HA Replication

@netologist
netologist / latency.markdown
Created July 11, 2022 12:08 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@netologist
netologist / asyncio.wait.py
Created May 25, 2022 11:55 — forked from Integralist/asyncio.wait.py
[Wait for multiple Python futures to finish using asyncio.wait()] #asyncio #wait #concurrency #multiple #requests #httpclient
import time
import asyncio
import requests
domain = 'http://integralist.co.uk'
a = '{}/foo?run={}'.format(domain, time.time())
b = '{}/bar?run={}'.format(domain, time.time())
async def get(url):
print('start: ', url)
@netologist
netologist / cka-ckad-bookmarks
Created February 25, 2021 19:51 — forked from milindchawre/cka-ckad-bookmarks
Bookmarks for cka and ckad exam
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1604897638" LAST_MODIFIED="0" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@netologist
netologist / recommendation-engine-services.md
Created August 2, 2012 09:17
Recommendation Engine Services

##Recommendation Engine Services

####IREUS Recommendation Engine for stores as SaaS

http://www.ireus.net/

####Plista

(cd /some/dir && zip -r - dir-there) > file.zip
https://unix.stackexchange.com/questions/77605/change-working-directory