diff options
Diffstat (limited to 'How-to')
| -rw-r--r-- | How-to/Custom handwired keyboard.md | 114 | ||||
| -rw-r--r-- | How-to/Python/Envelope (mathematics) generator/Envelope.png | bin | 80865 -> 0 bytes | |||
| -rw-r--r-- | How-to/Python/Envelope (mathematics) generator/Thumbnail.png | bin | 2297 -> 0 bytes | |||
| -rw-r--r-- | How-to/Python/Envelope (mathematics) generator/index.md | 35 | ||||
| -rw-r--r-- | How-to/Python/Logging.md | 114 | ||||
| -rw-r--r-- | How-to/Selfhost blog.md | 29 |
6 files changed, 0 insertions, 292 deletions
diff --git a/How-to/Custom handwired keyboard.md b/How-to/Custom handwired keyboard.md deleted file mode 100644 index b43ddcc..0000000 --- a/How-to/Custom handwired keyboard.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -description: Process of how to create a custom designed hardwired keyboard -created: 2024-03-01 ---- - -TODO ROUGH PRICE - -## Plan -Start out by getting a rough plan of what you want to make, so you can order parts, as takes a while, if you wish to do -it cheaply. - -First of all you need to decide how big your keyboard needs to be, do you wish to make an 100%, macropad, ultra-compact, -split, do you want dedicated buttons for all 24 function keys? none of the above? - -You can play around with [keyboard-layout-editor.com](http://www.keyboard-layout-editor.com/) to find a layout you like, -see different layout under "Preset" - -Massive repo of inspiration: [keebfolio.netlify.app](https://keebfolio.netlify.app/) - -### Switches -#### Design (Will affect keyboard design) -- Cherry MX design (classic, old, bulky, readily available, cloned into oblivion) -- Low profile? - - Kalih Choc (Expensive, different keycaps) - - Others - - [gateron.co - Gateron Low Profile 2.0 Mechanical Switch](https://www.gateron.co/products/gateron-low-profile-mechanical-switch-set) - - [keychron.com - Keychron Low Profile Mechanical Switch](https://www.keychron.com/products/keychron-low-profile-mechanical-switch) -Unsure, order a Switch tester or ask a friend to try their switches, to see what you like -#### Type -Generally there 3 types, originally made by cherry, I'd recommend none of them -- Clicky - Typically blue (obnoxious) -- Linear - Typically red (Did I press that button?) -- Tactile - Typically brown (Mushy) - -But do limit your scope enough, so you don't lose interest before completing the core project. -Be ready to test ideas feasibility and scrap them if infeasible. - -### Switch matrix -So what parts do you need? -You need to decide which method you wish to use, to wire up your switches -- Matrix with diodes (recommended method) - - Requires 1 diodes per switch, diodes are cheap - - Cable routing is more manageable -- Straight (1 wire per switch to microcontroller) - - Requires enough pins - -An I/O expander can be used to add additional pins to a microcontroller, it's also useful for split keyboards, -as it can require only 4 pins (I²C + power and ground) from the microcontroller - -## Order parts (Consumables) -### Checklist -#### Keyboard specific -- Switches -- Microcontroller, look at [QMK Compatible microcontrollers](https://docs.qmk.fm/#/compatible_microcontrollers), -i recommend a RP2040 based microcontroller -- Keycaps? Do you want to order these or [3D print them](#3d-printed-keycaps) -- Diodes [aliexpress.com - 1N4148](https://www.aliexpress.com/item/1005005435418695.html) -- Split keyboard parts - - I/O expander route - - I/O expander MCP23017 - - Connector [aliexpress.com - TRRS headphone jack](https://www.aliexpress.com/item/1005003146932723.html) - - Cable [aliexpress.com - TRRS headphone cable](https://www.aliexpress.com/item/1005001781279058.html) - -#### General maker -- 3D printed filament -- Solder tin -- Extra features? -Get wild, add an old [ThinkPad trackpoint](https://docs.qmk.fm/#/feature_ps2_mouse), -a [rollerball mouse](https://shop.pimoroni.com/products/trackball-breakout?variant=27672765038675), -rotary encoder, maybe LEDs. -- Heat shrink tube -- Magnet wire (can come in handy) - -### Tools - non consumables -- 3D printer -- Soldering iron -- Continuity tester (for debugging connections) -- - -## Waiting for parts -### Layout design finalisation -Staggered? -Ortholinear? -Something else entirely? - -[keyboard-layout-editor.com](http://www.keyboard-layout-editor.com/) - -[keyboard-layout-editor.com - My layout](http://www.keyboard-layout-editor.com/##@_backcolor=%23000000%3B&@_c=%230096a7&t=%23ffffff%0A%0A%0A%23ff8616%3B&=Esc%0A%0A%0AFnLock&_c=%236d6d6d%3B&=F1%0A%0A%0A%3Ci%20class%2F='fa%20fa-volume-off'%3E%3C%2F%2Fi%3E&=F2%0A%0A%0A%3Ci%20class%2F='fa%20fa-volume-down'%3E%3C%2F%2Fi%3E&=F3%0A%0A%0A%3Ci%20class%2F='fa%20fa-volume-up'%3E%3C%2F%2Fi%3E&=F4%0A%0A%0A%3Ci%20class%2F='fa%20fa-microphone-slash'%3E%3C%2F%2Fi%3E&=F5%0A%0A%0A%3Ci%20class%2F='fa%20fa-sun-o'%3E%3C%2F%2Fi%3E-&_x:3%3B&=F6%0A%0A%0A%3Ci%20class%2F='fa%20fa-sun-o'%3E%3C%2F%2Fi%3E+&=F7%0A%0A%0A%3Ci%20class%2F='fa%20fa-caret-left'%3E%3C%2F%2Fi%3E%3Ci%20class%2F='fa%20fa-caret-left'%3E%3C%2F%2Fi%3E&=F8%0A%0A%0A%3Ci%20class%2F='fa%20fa-play'%3E%3C%2F%2Fi%3E%3Ci%20class%2F='fa%20fa-pause'%3E%3C%2F%2Fi%3E&=F9%0A%0A%0A%3Ci%20class%2F='fa%20fa-caret-right'%3E%3C%2F%2Fi%3E%3Ci%20class%2F='fa%20fa-caret-right'%3E%3C%2F%2Fi%3E&_t=%23ffffff%3B&=F10&=F11&=F12&=Delete%3B&@_c=%23262626%3B&=%60%0A~&=1%0A!&=2%0A%2F@&=3%0A%23&=4%0A$&=5%0A%25&_x:3%3B&=6%0A%5E&_t=%23ffffff%0A%0A%0A%23ff8616%3B&=7%0A%2F&%0A%0A7&=8%0A*%0A%0A8&=9%0A%28%0A%0A9&=0%0A%29%0A%0A+&_t=%23ffffff%3B&=-%0A%2F_&=%2F=%0A+&_c=%236d6d6d%3B&=BckSp%3B&@=Tab&_c=%23262626%3B&=Q&=W&=E&=R&=T&_x:3%3B&=Y&_t=%23ffffff%0A%0A%0A%23ff8616%3B&=U%0A%0A%0A4&=I%0A%0A%0A5&=O%0A%0A%0A6&=P%0A%0A%0A%C3%97&_t=%23ffffff%3B&=%7B%0A%5B&=%7D%0A%5D&=%7C%0A%5C%3B&@_c=%236d6d6d&t=%23ffffff%0A%0A%0A%23ff8616%3B&=Comp%0A%0A%0ACapsL&_c=%23262626&t=%23ffffff%3B&=A&=S&=D&_n:true%3B&=F&=G&_x:3%3B&=H&_t=%23ffffff%0A%0A%0A%23ff8616&n:true%3B&=J%0A%0A%0A1&=K%0A%0A%0A2&=L%0A%0A%0A3&=%2F:%0A%2F%3B%0A%0A-&_t=%23ffffff%3B&=%22%0A'&_c=%230096a7&w:2%3B&=Enter%3B&@_c=%236d6d6d%3B&=Shift&_c=%23262626%3B&=Z&=X&=C&=V&=B&_x:3%3B&=N&_t=%23ffffff%0A%0A%0A%23ff8616%3B&=M%0A%0A%0A0&=%3C%0A,%0A%0A,&=%3E%0A.%0A%0A.&=%3F%0A%2F%2F%0A%0A%2F%2F&_c=%236d6d6d&t=%23ffffff%3B&=PgUp&_c=%23c1c1c1&t=%23000000%3B&=%E2%86%91&_c=%236d6d6d&t=%23ffffff%3B&=PgDn%3B&@=Ctrl&=Super&=Alt&_t=%23ff8616%3B&=Fn&_c=%23262626&t=%23ffffff&a:7&w:2%3B&=&_x:2&c=%23c1c1c1&t=%23000000&a:4%3B&=mous1&=mous2&=mous3&_c=%236d6d6d&t=%23ffffff%0A%0A%0A%23ff8616%3B&=Menu%0A%0A%0AInsert&=Home%0A%0A%0APrtSc&_t=%23ffffff%3B&=End&_c=%23c1c1c1&t=%23000000%3B&=%E2%86%90&_n:true%3B&=%E2%86%93&=%E2%86%92) - -## Other great guides - - -## Switch plate generation -### Testing fit - -### 3D printing -#### 3D printed keycaps - - -### Wiring test 3x3 -The best way to eliminate unknowns and avoid wasting work, is by wiring up a small part, and testing this - -### Firmware setup - - -### No unknowns, home run, final stretch, grind - -### Extra firmware features -Inspire, show opportunities -grep QMK repo - -### Show off - -### Get ideas for your next version \ No newline at end of file diff --git a/How-to/Python/Envelope (mathematics) generator/Envelope.png b/How-to/Python/Envelope (mathematics) generator/Envelope.png deleted file mode 100644 index f7cf72c..0000000 --- a/How-to/Python/Envelope (mathematics) generator/Envelope.png +++ /dev/null Binary files differdiff --git a/How-to/Python/Envelope (mathematics) generator/Thumbnail.png b/How-to/Python/Envelope (mathematics) generator/Thumbnail.png deleted file mode 100644 index 01eb49e..0000000 --- a/How-to/Python/Envelope (mathematics) generator/Thumbnail.png +++ /dev/null Binary files differdiff --git a/How-to/Python/Envelope (mathematics) generator/index.md b/How-to/Python/Envelope (mathematics) generator/index.md deleted file mode 100644 index 79e92de..0000000 --- a/How-to/Python/Envelope (mathematics) generator/index.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: Generating geometric line art -created: 2024-05-12 ---- - - - -Needed a clean picture of [Envelope (mathematics)](https://en.wikipedia.org/wiki/Envelope_%28mathematics%29), -for PCB silk screen art. -I used [Python Pillow](https://python-pillow.org/) -``` -pip install pillow~=10.3 -``` - -```python -from PIL import Image, ImageDraw - -# https://en.wikipedia.org/wiki/Envelope_%28mathematics%29 - -dim = 200 # Image dimensions (pixels) -skip = 10 # Only draw a line every X pixels -width = 1 # Line width -color = "white" - -with Image.new(mode = "RGB", size = (dim, dim)) as im: # mode="RGBA" for transparent background - draw = ImageDraw.Draw(im) - - for i in range(dim): - if i % skip: - continue - rev = dim - i - draw.line([(0, i), (i, dim)], fill=color, width=width) - - im.show() # im.save("/tmp/Envelope.png") -``` \ No newline at end of file diff --git a/How-to/Python/Logging.md b/How-to/Python/Logging.md deleted file mode 100644 index 867dc20..0000000 --- a/How-to/Python/Logging.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -created: 2024-03-17 -description: Python logging with ✨pretty colors🌸 ---- - -## Logging > print -Logging is useful, because all python code can use the same standard, allowing you to centrally control: - -- Which messages you wish to see - - Every debug message, for local development - - Disable debug messages, by changing 1 line e.g. for end user deployment -- How to format them - - Do you wish to see which module and line of code this message originated from -- Where they should end up - - Printed to [STDOUT](https://en.wikipedia.org/wiki/Standard_streams) (terminal) - - A log file - - A log server - - Maybe a notification should be triggered on CRITICAL errors - -> A python [*"module"*](https://docs.python.org/3/tutorial/modules.html) is simply just the name for a .py file. -> e.g. the file `database_handler.py` is a module called `database_handler` - -```py -import logging - - -class ColorFormatter(logging.Formatter): - grey = "\x1b[90;20m" - cyan = "\x1b[96;20m" - yellow = "\x1b[33;20m" - red = "\x1b[31;20m" - bold_red = "\x1b[31;1m" - reset = "\x1b[0m" - format = "%(asctime)s,%(msecs)03d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s" - - FORMATS = { - logging.DEBUG: grey + format + reset, - logging.INFO: cyan + format + reset, - logging.WARNING: yellow + format + reset, - logging.ERROR: red + format + reset, - logging.CRITICAL: bold_red + format + reset - } - - def format(self, record): - log_fmt = self.FORMATS.get(record.levelno) - formatter = logging.Formatter(log_fmt) - return formatter.format(record) - - -logger = logging.getLogger(__name__) # Instantiate a logger to be used in this module - -# Display every message Change this to INFO to see INFO and above (filter out DEBUG) -# See: https://docs.python.org/3/howto/logging.html#logging-levels -logger.root.setLevel(logging.DEBUG) - -stream_handler = logging.StreamHandler() # This catches and handles log messages on the root handler -stream_handler.setFormatter(ColorFormatter()) -logger.root.addHandler(stream_handler) - -logger.debug("debug message") -logger.info("info message") -logger.warning("warning message") -logger.error("error message") -logger.critical("critical message") -``` - -> Code snippet is modified, but based on: -> [stackoverflow.com - How can I color Python logging output?](https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output#answer-56944256). -> Used and credited as per [stackoverflow.com - CC BY-SA 4.0 content license](https://stackoverflow.com/help/licensing) - -<pre> -$ python /tmp/1.py -<span style="color:grey">2024-03-17 14:09:06,411,411 DEBUG [1.py:37] debug message</span> -<span style="color:var(--main-color)">2024-03-17 14:09:06,411,411 INFO [1.py:38] info message</span> -<span style="color:yellow">2024-03-17 14:09:06,411,411 WARNING [1.py:39] warning message</span> -<span style="color:red">2024-03-17 14:09:06,411,411 ERROR [1.py:40] error message</span> -<span style="font-weight: bold; color:red">2024-03-17 14:09:06,411,411 CRITICAL [1.py:41] critical message</span> -</pre> - - -In subsequent modules, do the following: -```py -import logging - -logger = logging.getLogger(__name__) # Set the logger name, to the name of the module - -logger.debug("debug message") -logger.info("info message") -logger.warning("warning message") -logger.error("error message") -logger.critical("critical message") -``` - -> Wish to change the colors? -> Color codes can be found here: [wikipedia.org - ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit) - -Okay, but why do we need to do it this way? - -Because logging is hieratical, these 2 loggers will be siblings under the root logger (see following tree structure). -Therefore we set a handler on the root logger which ensures all logging will hit our formatting code. - -<pre> -$ root -├── <span class="devicons devicons-python"></span> main -└── <span class="devicons devicons-python"></span> module_a -</pre> - -You can set a breakpoint and inspect `logger.parent` to see this structure: -```pycon ->>> logger.parent -<RootLogger root (DEBUG)> -``` - -Read more: [docs.python.org - Logging HOWTO](https://docs.python.org/3/howto/logging.html) diff --git a/How-to/Selfhost blog.md b/How-to/Selfhost blog.md deleted file mode 100644 index 0ad9e94..0000000 --- a/How-to/Selfhost blog.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: How to create, and self host a blog like this -created: 2024-03-01 ---- - -## Chose a static site generator -This is the tool that takes your [markdown](https://www.markdownguide.org/basic-syntax/) or other markup language, -and generates HTML files, these can then uploaded to a server to host. - -- [Hugo](https://gohugo.io/) -- [Pelican](https://getpelican.com/) -- [My custom one](https://git.node5.net/blog/blog-generator/about/) - -## Buy a domain -### Chose a TLD (Top Level Domain) -.net is pretty cool IMO - -## Hosting - -- Selfhost - - At home - - Requires static IP - - Router port forward - - Always having a machine online - - Exposes your home IP (This isn't super bad) -- VPS (cloud monthly payment) - - Not independent - -For the rest of this I refer to the awesome guides at [landchad.net](https://landchad.net/) |
