Good Reads
2023-06-23 How my online gaming addiction saved my Ph.D. – Advait Sarkar
Previously, this might have taken me weeks. With JavaScript, I built the prototype in hours. Using web technology had another advantage: it was easy to deploy the study as a website and therefore get many more participants than I would have normally gotten in a lab-based experiment. The study was completed within a month and was published at a good conference.
2023-06-19 Imaginary Problems Are the Root of Bad Software
In this blog post, the author discusses *imaginary problems* as the root of bad software and how they affect developers, managers, and clients. He:
- Defines imaginary problems as problems that are designed to do something other than their intended purpose, and contrast them with real problems that have to be solved.
- Shows how long chains of communication and boredom can create imaginary problems by changing, misunderstanding, or misrepresenting requirements and specifications.
- Examines how corruption, inertia, and fear can keep imaginary problems alive by preventing or discouraging fixing real problems that threaten the status quo or the livelihoods of others.
- Provides examples and data from various domains and projects to illustrate the prevalence and impact of imaginary problems, such as online banking, blockchain, and software development.
- Concludes that imaginary problems are a vicious cycle that prevents software from being reliable, efficient, or user-friendly, and that everyone needs to stop creating and solving them, and start focusing on the real problems.
2023-06-17 Generating income from open source
Open source projects need to charge money for their work. The author argues that donations are not enough to sustain open source projects and maintainers should adopt different business models to generate revenue. The author suggests several ways to charge money for open source work, such as different licenses, pro features, hosted solutions, or paid support.
Examples of successful open source businesses. The author provides several examples of open source projects that have built profitable businesses around their work, such as Metafizzy, Sidekiq, Plausible Analytics, PostHog, Metabase, React Flow, Babel, curl and Filippo Valsorda. The author explains how each project offers value to its customers and what kind of pricing or support they have.
Advice for open source maintainers. The author gives some advice for open source maintainers who want to start charging money for their work, such as understanding the value they provide, packaging their product well, letting people discover their paid plans, giving something of value immediately after purchase and offering insurance that their project will be maintained. The author encourages maintainers to try different options and not be ashamed of asking for money.
2023-06-14 Finish your projects
This article is about the importance and challenges of finishing a project, especially in the open source community. The author shares his personal experience and insights on how to overcome the obstacles of work and fear that often prevent people from releasing their projects. He also encourages readers to take pride in their finished work and to honor their past and future selves by publishing their projects. He concludes by introducing himself and The ReadME Project, which aims to amplify the voices of open source developers.
2023-06-12 The Surprising Power of Documentation
- Documentation saves time and improves productivity across the company.
- Documentation eradicates guesswork and reinvention of the wheel.
- Documentation enables fast onboarding and helps newcomers navigate startup processes.
- Documentation reduces the reliance on meetings and promotes asynchronous communication.
- Documentation serves as a knowledge repository and facilitates learning from past decisions.
- A documentation-first culture breaks down hierarchical barriers and promotes knowledge sharing.
- Templates, guidelines, and user-friendly tools should be provided to facilitate documentation.
- Resistance to documentation should be addressed through engagement and modeling behavior.
- Documentation should be clear, concise, well-structured, and easily accessible.
- Startups should cultivate a love for documentation and make it a daily practice
2023-07-02 Hashing
Hash functions, key to many aspects of computing such as databases, data structures, and security, are explored in this piece. These functions take an input, often a string, and generate a number. If a good hash function is used, it will always return the same number for the same input, while minimizing 'collisions' where different inputs produce the same number. This article evaluates the performance of hash functions, highlighting their efficacy with random and non-random inputs. An effective hash function, like the widely-used murmur3, provides even distribution regardless of input. The 'avalanche effect' is another measure of a good hash function, where a single change in the input results in an average 50% change in the output bits. Understanding hash functions is essential in utilizing key-value pair storing data structures known as maps.
Books
2023-05-07 A Programmer's Introduction to Mathematics
Azure Active Directory
2023-06-29 Demystifying OAuth, JWTs and Azure AD - Graeme Foster - NDC Oslo 2023 - YouTube
Good video by Graeme Foster about how AAD OAuth works with demos. Video starts from 16:50
Emacs
2023-07-02 p3r7/awesome-elisp: 🏵️ A curated list of Emacs Lisp development resources
Awesome List
TypeScript
2023-07-02 The Concise TypeScript Book (Free and Open Source) by Simone Poggiali
CSharp
danielmarbach/PerformanceTricksAzureSDK: Performance tricks I learned from contributing to the Azure .NET SDK github repository for this talk.
LINQ TO COLLECTION-BASED OPERATIONS
- Use
Array.Empty<T>()
to represent empty arrays- Use
Enumerable.Empty<T>
to represent empty enumerables- Prevent collections from growing
HOW TO DETECT ALLOCATIONS?
Use memory profilers and watch out for excessive allocations of
*__DisplayClass*
or various variants ofAction*
andFunc*
Use tools like Heap Allocation Viewer (Rider) or Heap Allocation Analyzer (Visual Studio)
Avoid excessive allocations to reduce the GC overhead
Think at least twice before using LINQ or unnecessary enumeration on the hot path
Be aware of closure allocations
Pool and re-use buffers
For smaller local buffers, consider using the stack
Be aware of parameter overloads
Where possible and feasible use value types but pay attention to unnecessary boxing
Move allocations away from the hot-path where possible
C# 9 - Improving performance using the SkipLocalsInit attribute - Meziantou's blog
C++
2023-06-24 👃 60 terrible tips for a C++ developer
60 Dirty tips for dirty developers ;)
- Terrible tip N3. Nested macros
- Terrible tip N4. Disable warnings
- Terrible tip N5. The shorter the variable name is, the better
- Terrible tip N6. Invisible characters
- Terrible tip N7. Magic numbers
- Terrible tip N8. int, int everywhere
- Terrible tip N9. Global variables
- Terrible tip N10. The abort function in libraries
- Terrible tip N11. The compiler is to blame for everything
- Terrible tip N12. Feel free to use argv
... and the list goes on and on
2023-06-24 Make your programs run faster by better using the data cache - Johnny's Software Lab
It covers the following topics and tips:
- The concept and importance of cache memory and how it compensates for the difference in speed between processor and main memory.
- The principles of temporal and spatial locality, which govern the behavior of real-world programs and affect the cache performance.
- The tips and rules for better exploiting the data cache in different scenarios, such as:
- Using arrays of classes or structs instead of values, to increase the cache utilization and reduce the cache misses.
- Aligning the starting address of the array and the class data to the cache line size, to avoid splitting the data across multiple cache lines and to optimize the cache access.
- Performing loop interchange on matrices, to move the loop over the innermost position and to eliminate column-wise accesses, which are costly for the cache.
- Avoiding padding in classes and structs, to make sure they are correctly aligned and to reduce the cache overhead.
- Sorting the variables in the declaration of the classes by size from largest to smallest, to guarantee that the compiler will not insert any padding and to optimize the cache access.
- The tools and references available to help with the data cache optimization, such as pahole and StuctLayout, which can help with exploring and visualizing the paddings in the classes.
2023-06-15 ReactiveX/RxCpp: Reactive Extensions for C++
2023-06-14 Text Editor Data Structures - invoke::thought() - Cameron DaCamara
In The Beginning…
I am a strong believer in “experiment and get things working as fast as possible”—essentially, a fail fast mentality. This is not to say that your first pass should ignore optimization, and I refuse to pessimize my code. That said, I started from the simplest possible representation of a text file to start: a giant string.
There are some pretty great properties of having a single string as your text buffer:
- It is the most compact possible representation.
- The algorithms for insertion and removal are simple.
- It is very friendly to the rendering process because you can slice up the string into views which can be independently rendered without additional allocation.
- Did I mention it is simple?
Here’s a short example of insertion and deletion:
C
1993 ⭐ Object-oriented Programming with ANSI-C (1993) [pdf]
Retro document! but very well written
2023-06-14 Leo Robinovitch @ The Leo Zone
2023-07-01 Few lesser known tricks, quirks and features of C
There are some tricks, quirks and features (some quite fundamental to the language!) which seems to throw even experienced developers off the track. Thus I did a sloppy job of gathering some of them in this post (in no particular order) with even sloppier short explanations and/or examples (or quote of thereof).
- Array pointers
- Comma operator
- Digraphs, trigraphs and alternative tokens
- Designated initializer
- Compound literals
- Compound literals are lvalues
- Multi-character constants
- Bit fields
- 0 bit fields
volatile
type qualifierrestrict
type qualifierregister
type qualifier- Flexible array member
%n
format specifier%.*
(minimum field width) format specifier- Other less known format specifiers
- Interlacing syntactic constructs
-->
"operator"- [
idx[arr\]
](https://jorengarenar.github.io/blog/less-known-c#idxarr)- Negative array indexes
- Constant string concatenation
- Backslash line splicing
- Using
&&
and||
as conditionals- Compile time assumption checking using
enum
s- Ad hoc
struct
declaration in the return type of a function- "Nested"
struct
definition is not kept nested- Flat initializer lists
- Implicit casting of
void
pointers- Static array indices in function parameter declarations
- Macro Overloading by Argument List Length
- Function types
- X-Macros
- Named function parameters
- Combining default, named and positional arguments
- Abusing unions for grouping things into namespaces
- Unity builds
- Matching character classes with
sscanf()
- Garbage collector
- Cosmopolitan Libc
- Inline assembly
- Object Oriented Programming
- Metaprogramming
- Evaluate
sizeof
at compile time by causing duplicate case error
2023-06-30 Structures in C: From Basics to Memory Alignment – Abstract Expression
Structures allow us to combine several variables to create a new data type. Some other languages support the same concept but call it “records”. If you come from object-oriented programming you can think about them as classes without methods.
SIMD
2023-07-02 Parsing time stamps faster with SIMD instructions – Daniel Lemire's blog
Standard:
#include <time.h>
#include <stdio.h>
int main() {
char buffer[15];
struct tm timeinfo;
time_t rawtime;
time(&rawtime);
gmtime_r(&rawtime, &timeinfo);
size_t len = strftime(buffer, 15, "%Y%m%d%H%M%S", &timeinfo);
buffer[14] = '\0';
puts(buffer);
}
SIMD:
__m128i v = _mm_loadu_si128((const __m128i *)date_string);
v = _mm_sub_epi8(v, _mm_set1_epi8(0x30));
__m128i limit =
_mm_setr_epi8(9, 9, 9, 9, 1, 9, 3, 9, 2, 9, 5, 9, 5, 9, -1, -1);
__m128i abide_by_limits = _mm_subs_epu8(v, limit); // must be all zero
const __m128i weights = _mm_setr_epi8(
10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 0, 0);
v = _mm_maddubs_epi16(v, weights);
__m128i limit16 =
_mm_setr_epi16(99,99, 12, 31, 23, 59, 59, -1);
__m128i abide_by_limits16 = _mm_subs_epu16(v, limit16);
__m128i limits = _mm_or_si128(abide_by_limits16,abide_by_limits);
if (!_mm_test_all_zeros(limits, limits)) {
return false;
}
instructions per stamp | time per stamp | |
---|---|---|
standard C with strptime | 700 | 46 |
SIMD approach | 65 | 7.9 |
Rust
2023-06-16 Effective Rust
Effective Rust
35 Specific Ways to Improve Your Rust Code
David Drysdale
Security
2023-06-12 Desktop Linux Hardening | PrivSec - A practical approach to Privacy and Security
ToC
- During Installation
- Privacy Tweaks
- Application Confinement
- Security Hardening
- Secure Boot
Projects
2023-06-23 Style your RSS feed
RSS is not dead. It is not mainstream, but it's still a thriving protocol, especially among tech users. However, many people do not know what RSS feeds are or how to use them. Most browsers render RSS as raw XML files, which doesn't help users understand what it's all about...
2023-06-15 TypeCell Notebooks
TypeCell is an open source Typescript live programming environment.
Running code has never been easier :)
this is what I was looking for
2023-06-15 TypeCellOS/TypeCell
2023-07-01 Announcing Hurl 4.0.0
Hurl is a command line tool powered by curl, that runs HTTP requests defined in a simple plain text format:
GET https://example.org/api/tests/4567
HTTP 200
[Asserts]
header "x-foo" contains "bar"
certificate "Expire-Date" daysAfterNow > 15
jsonpath "$.status" == "RUNNING" # Check the status code
jsonpath "$.tests" count == 25 # Check the number of items
jsonpath "$.id" matches /\d{4}/ # Check the format of the id
2023-06-30 Introduction - mdBook Documentation
mdBook is a command line tool to create books with Markdown. It is ideal for creating product or API documentation, tutorials, course materials or anything that requires a clean, easily navigable and customizable presentation.
- Lightweight Markdown syntax helps you focus more on your content
- Integrated search support
- Color syntax highlighting for code blocks for many different languages
- Theme files allow customizing the formatting of the output
- Preprocessors can provide extensions for custom syntax and modifying content
- Backends can render the output to multiple formats
- Written in Rust for speed, safety, and simplicity
- Automated testing of Rust code samples
This guide is an example of what mdBook produces. mdBook is used by the Rust programming language project, and The Rust Programming Language book is another fine example of mdBook in action.
Who wrote this?
2023-06-11 I Created Clippy - YouTube
2023-07-02 kevan atteberry
This guy made a monster! Just kidding, Clippy will be awesome! The character is there, now it needs AI! #ms
2023-06-11 Inside Task Manager with the Original Author - YouTube
2023-07-02 Dave's Garage - YouTube
How Task Manager was born, how it works, and insider secrets to using it! For information on my book, "Secrets of the Autistic Millionaire": https://amzn.to/3diQILq #ms 2023-06-11 How To Launch Nuclear Missile - YouTube
Workplace
2023-07-01 Leveling Up in Job Interviews for Software Engineers
2023-07-02 How you can ~1.5x your salary through negotiation
Videos
2023-06-26 Email vs Capitalism, or, Why We Can't Have Nice Things - Dylan Beattie - NDC Oslo 2023 - YouTube
Dylan is amazing speaker ;) fun conversation about the history of email, current limitations and how it works.
2023-06-17 Don't Talk to the Police - YouTube
I saw it years ago! I remember this video.