Skip to content

Instantly share code, notes, and snippets.

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

daoleno daoleno

🤘
rock & roll
View GitHub Profile
  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

> 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]
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void bucketSort(float arr[], int n) {
// 1) Create n empty buckets
vector<float> b[n];
#define BINARY_OP(op) \
    do { \
      double b = pop(); \
      double a = pop(); \
      push(a op b); \
    } while (false)
@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.

@daoleno
daoleno / vm.md
Created March 5, 2018 03:14
What should a virtual machine generally implement?
  • Compilation of source language into VM specific bytecode
  • Data structures to contains instructions and operands (the data the instructions process)
  • A call stack for function call operations
  • An ‘Instruction Pointer’ (IP) pointing to the next instruction to execute
  • A virtual ‘CPU’ – the instruction dispatcher that
    • Fetches the next instruction (addressed by the instruction pointer)
    • Decodes the operands
  • Executes the instruction
@daoleno
daoleno / server_client.md
Created February 4, 2018 15:55
strace and nc

Server

strace -r -e trace=bind,listen,accept,poll,read,write nc -l -p 8080 

Client

strace -r -e trace=connect,poll,read,write,close nc 127.0.0.1 8080
@daoleno
daoleno / struct_tips_in_c.md
Created January 15, 2018 06:52
struct tips in c
typedef struct X { 
    int x; 
} X;

struct S { 
    int x; 
};
typedef struct S S;
@daoleno
daoleno / hanoi.ml
Created January 11, 2018 11:29
OCaml version hanoi tower
(* move n discs from a to z (using third peg named x) *)
let rec hanoi move n a z x = if n = 0 then () else
(hanoi move (n-1) a x z ; move n a z ; hanoi move (n-1) x z a)
let printmove disc a b = print_endline
("Move disc " ^ (string_of_int disc) ^ " from " ^ a ^ " to " ^ b) ;;
hanoi printmove 4 "peg A" "peg C" "peg B"
@daoleno
daoleno / book_list.md
Last active February 17, 2020 01:40
book list