Skip to content

Instantly share code, notes, and snippets.

View dungsaga's full-sized avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / System Design.md
Created November 9, 2022 08:01 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@dungsaga
dungsaga / email-regex.md
Last active January 15, 2023 00:43
practical email regex

This is my attempt to improve on the regex that match 99.99% of email from https://www.regular-expressions.info/email.html

This is a practical implementation of RFC 5322 where I omitted IP addresses, domain-specific addresses, the syntax using double quotes and square brackets.

  • Maximum length of email address is 254
  • Maximum length of the local part is 64
  • The local part must not contain double dots and must not start or end with a dot.
  • Maximum length of each domain label is 63
  • The domain part must contain at least 2 domain labels, each domain label must not start or end with a hyphen. Domain labels are separated by 1 dot.
  • The top level domain must contain only alphabet letters and must contain at least 2 letters.
@dungsaga
dungsaga / compare-some-pdf-readers.md
Last active July 25, 2024 07:45
picoPDF disk usage is tiny. Let's compare some PDF readers.

I read the blog post Lessons learned from 15 years of SumatraPDF, an open source Windows app and appreciate the effort to make it the most lightweight PDF reader today.

But then I recall that it was much more smaller when it was announced. I found some old 32-bit versions in FileHorse: image image

The size of the installer increased from 1MB to 4MB to 6MB. The installed size would be around 2.2 or 2.5 times bigger.

I understand that SumatraPDF depends from libmupdf (which is 11MB in my 64-bit version) and libmupdf support many more file formats than Poppler. On top of that, SumatraPDF added support for many compressed archive formats and modern image formats.

@dungsaga
dungsaga / force-ctrl-c-v.md
Created May 13, 2023 02:54 — forked from Gustavo-Kuze/force-ctrl-c-v.md
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

@dungsaga
dungsaga / composer.json
Created May 22, 2023 11:55 — forked from mfurlend/composer.json
composer require git repository
{
"name": "my_vendor_name/my_package",
"description": "My Package Description",
"license": "GPL-3.0",
"autoload": {
"classmap": [ // search these directories for classes
"lib/"
]
},
"repositories": {

A complete list of books, articles, blog posts, videos and neat pages that support Data Fundamentals (H), organised by Unit.

Formatting

If the resource is available online (legally) I have included a link to it. Each entry has symbols following it.

  • ⨕⨕⨕ indicates difficulty/depth, from ⨕ (easy to pick up intro, no background required) through ⨕⨕⨕⨕⨕ (graduate level textbook, maths heavy, expect equations)
  • ⭐ indicates a particularly recommended resource; 🌟 is a very strongly recommended resource and you should look at it.

Estimation

This document is an attempt to pin down all the things you don't think about when quoting for a project, and hopefully provide a starting point for some kind of framework to make quoting, working and delivering small-medium jobs more predictable and less stressful.

Quoting

The hardest bit of any job, and lots of pitfalls

Estimating the work

  • the actual work of what you see on screen will only be a fraction of the work to do