Skip to content

Instantly share code, notes, and snippets.

View daoleno's full-sized avatar
🤘
rock & roll

daoleno daoleno

🤘
rock & roll
View GitHub Profile
@daoleno
daoleno / Richard Feynman technique.md
Created March 28, 2018 15:59
Richard Feynman technique

Step 1. Choose the concept you want to understand.

Take a blank piece of paper and write that concept at the top of the page.

Step 2. Pretend you’re teaching the idea to someone else.

Write out an explanation of the topic, as if you were trying to teach it to a new student. When you explain the idea this way you get a better idea of what you understand and where you might have some gaps.

Step 3. If you get stuck, go back to the book.

Whenever you get stuck, go back to the source material and re-learn that part of the material until you get it enough that you can explain it on paper.

Step 4. Simplify your language.

#define BINARY_OP(op) \
    do { \
      double b = pop(); \
      double a = pop(); \
      push(a op b); \
    } while (false)
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void bucketSort(float arr[], int n) {
// 1) Create n empty buckets
vector<float> b[n];
> telnet exampledomain.com 25
Trying 1.1.1.1...
Connected to exampledomain.com (1.1.1.1).
Escape character is '^]'.
220-server1.exampledomain.com ESMTP Exim 4.66 #1 Wed, 09 May 2007 23:55:12 +0200
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
> EHLO exampledomain.com
250-server1.exampledomain.com Hello [1.1.1.2]
  1. Implementing the main feature first
  2. Writing the test afterwards
  3. Running the test to see it succeed
  4. Commenting out critical parts of the feature code
  5. Running the test to see it fail
  6. Uncommenting feature code to its original state
  7. Running the test to see it succeed again
  8. Commiting the code

Reference: http://blog.codepipes.com/testing/software-testing-antipatterns.html

@daoleno
daoleno / beform_main.md
Created May 14, 2018 01:16
What happens before main() function is executed in C.
  • The hardware is initialized. The most important part of this step is setting up the clock that the CPU needs to run the code. This is usually done by programming a PLL (essentially a programmable clock). If there is not clock going to the CPU, the CPU is essentially dead. The other part of hardware initialization is initializing the interrupt handling hardware.
  • Memory segments are initialized. Memory segments such as .bss (for uninitialized data), .data (for initialized data such as static variables, global variables, local static variables, addresses of functions, and function pointers), and .text (where the actual code resides) are initialized and a valid stack is set up.
  • Command line arguments are received. This may not be relevant in embedded systems as in embedded systems we don’t usually call main() with arguments
  • The stack pointer is configured. This is necessary because the program needs to know where to start from.
@daoleno
daoleno / EventSourcing.md
Created May 20, 2018 15:10
What is Event Sourcing?
  • Events to provide a history
  • Aggregates to represent the current state of the application
  • Calculator to update the state of the application
  • Reactors to trigger side effects as events happen

img

@daoleno
daoleno / regex.md
Last active August 12, 2018 10:48
some regex

domain

sample.com

^(\*\.)?([a-zA-Z0-9-]+\.){0,5}[a-zA-Z0-9-]+\.[a-zA-Z]{1,63}$

hostname

^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
Client sends HTTP request → Nginx chooses the appropriate handler based on the location config → (if applicable) load-balancer picks a backend server → Handler does its thing and passes each output buffer to the first filter → First filter passes the output to the second filter → second to third → third to fourth → etc. → Final response sent to client

reference

Emiller’s Guide To Nginx Module Development