Random (To be sorted)

Websites

https://awslabs.github.io/smithy/quickstart.html

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

* The 20 Minute Business Plan -> https://www.alexandercowan.com/business-model-canvas-templates/

# eg. ./whiteboardClean.sh example1.jpg output1.png

Applescript droplet -> paste this into a new script and save it as an application -> https://gist.github.com/lelandbatey/8677901#gistcomment-1205710

on open thefiles
  repeat with thefile in thefiles
    set finalpath to POSIX path of thefile
    do shell script "mktemp -t image"
    set temppath to the result
    set success to false
    try
      do shell script "/usr/local/bin/convert '" & finalpath & "' -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 '" & temppath & "'"
      set success to true
    on error theerror
      display dialog "Conversion failed: " & theerror
    end try
    if success then
      do shell script "mv '" & temppath & "' '" & finalpath & "'"
      display notification "Converted " & finalpath
    end if
  end repeat
end open

Convert to SVG using http://autotrace.sourceforge.net/ -> https://gist.github.com/lelandbatey/8677901#gistcomment-1205798

./autotrace \
  --dpi 1024 \
  --line-threshold 0.1 \
  --color-count 16 \
  --corner-always-threshold 60 \
  --line-reversion-threshold 0.1 \
  --width-weight-factor 0.1 \
  --despeckle-level 10 \
  --despeckle-tightness 5 \
  --preserve-width \
  --remove-adjacent-corners \
  --output-format svg \
  --output-file out.svg \
  in.png

Also check https://mzucker.github.io/2016/09/20/noteshrink.html https://github.com/santhalakshminarayana/whiteboard-image-enhance

digraph architecture {
  rankdir=LR;

  // Storage - #303F9F (dark blue)
  node[fillcolor="#303F9F" style="filled" fontcolor="white"];
  database[label="DB"]; cache[label="Redis"];
  
  // Client-side Apps - #FFEB3B (yellow)
  node[fillcolor="#FFEB3B" style="filled" fontcolor="black"];
  front_end[label="Front-end App"]; extension[label="Browser Extension"];
  
  // Microservices - #C8E6C9 (light green)
  node[fillcolor="#C8E6C9" style="filled" fontcolor="black"];
  photos_ms[label="Photos MS"]; chats_ms[label="Chats MS"]; friends_ms[label="Friends MS"];
  
  // API Gateways - #FFCCBC (light orange)
  node[fillcolor="#FFCCBC" style="filled" fontcolor="black"];
  auth_api[label="Auth API"]; my_app_api[label="Main API"];
  
  // 3rd-party APIs - #CFD8DC (light grey)
  node[fillcolor="#CFD8DC" style="filled" fontcolor="black"];
  facebook_api[label="Facebook API"];
  
  subgraph client_side_apps {
      front_end -> {auth_api, my_app_api};
      extension -> {auth_api, my_app_api};
      
      {rank=same; front_end, extension, auth_api};
  }
  
  subgraph api_gateways {
      my_app_api -> {photos_ms, chats_ms, friends_ms};
  }
  
  subgraph microservices {
      photos_ms -> {database};
      chats_ms -> {database, cache};
      friends_ms -> {database, facebook_api};
  }
} 

Blog posts

Notes

  • Pass arguments to Make task
# Makefile
pre-commit-tool: ## Manually run a single pre-commit hook
    ./venv/bin/pre-commit run $(TOOL) --all-files

# Run it as
make pre-commit-tool TOOL=black

We start with finding the ASCII value of : which is 58. See ASCII table

Convert 58 to binary using Short division by Two with Reminder. i.e. Divide the answer by 2 and keeping the reminder which will be the binary form.

58/2 = 29 => Reminder 0
29/2 = 14 => Reminder 1
14/2 = 7  => Reminder 0
7/2  = 3  => Reminder 1
3/2  = 1  => Reminder 1
1/2  = na => Reminder 1

So the binary form is 111010 if we line up all the reminders Padding the output will make it 00111010.

Convert the binary into two parts of 4 bits each.

0011 1010

Using the following Hex table conversion, we map 0011 => 3 and 1010 to A which becomes 3A.

Decimal Binary Hex
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

The final part is to prefix it with % (which is the escape character) makes it %3A