If you've been doing typescript for a while this could be interesting:
https://effect.website/
Effect introduces a new way to write typescript applications. it's mostly famous for its error handling method, basically there isn't any throw/try/catch. Errors are considered values and this usually results in safer programs
https://effect.website/
Effect introduces a new way to write typescript applications. it's mostly famous for its error handling method, basically there isn't any throw/try/catch. Errors are considered values and this usually results in safer programs
effect.website
Effect – The best way to build robust apps in TypeScript
Effect is a powerful TypeScript library designed to help developers easily create complex, synchronous, and asynchronous programs.
Accio
Footage from: Conway's game of life
Celluar automaton
A very simple yet interesting autometa theory. It consists of a grid which has a finate number of states (or squares) that can be on or off, each having ,for example, 8 neighbors. It also has a starting condition (The only input given to the machine) and then it simply iterates over and updates the grid based on its given conditions.
A basic example of it is the Conway's Game of Life which simulates, life!
In Conway's Game of Life, cells are either alive (black) or dead (white).
At each step:
- Any alive cell with fewer than two live neighbors dies, as if by underpopulation
- Any alive cell with two or three neighbors lives on
-Any alive cell with more than 3 live neighbors dies. As if by overpopulation
-Any dead cell with exactly 3 live neighbors becomes alive as if by reproduction
This may seem very basic, but it applies to other areas such as chemistry, biology, physics and even in music!
More on cellular automaton:
https://en.m.wikipedia.org/wiki/Cellular_automaton
#FSA #computation
A very simple yet interesting autometa theory. It consists of a grid which has a finate number of states (or squares) that can be on or off, each having ,for example, 8 neighbors. It also has a starting condition (The only input given to the machine) and then it simply iterates over and updates the grid based on its given conditions.
A basic example of it is the Conway's Game of Life which simulates, life!
In Conway's Game of Life, cells are either alive (black) or dead (white).
At each step:
- Any alive cell with fewer than two live neighbors dies, as if by underpopulation
- Any alive cell with two or three neighbors lives on
-Any alive cell with more than 3 live neighbors dies. As if by overpopulation
-Any dead cell with exactly 3 live neighbors becomes alive as if by reproduction
This may seem very basic, but it applies to other areas such as chemistry, biology, physics and even in music!
More on cellular automaton:
https://en.m.wikipedia.org/wiki/Cellular_automaton
#FSA #computation
Accio
GIF
Visualization of a lattice gas automaton. The shades of grey of the individual pixels are proportional to the gas particle density (between 0 and 4) at that pixel. The gas is surrounded by a shell of yellow cells that act as reflectors to create a closed space.
From CA wikipedia page
From CA wikipedia page
Accio
Footage from: Conway's game of life
If you are wondering where does such automata stands in terms of computational power, it is turing-complete
❤1
Accio
Photo
Build your own text editor with C in terminal
https://viewsourcecode.org/snaptoken/kilo
Kilo is a text editor written in C with <1000 lines of code (Thats why it's called a Kilo)
The link above is a step by step walk through of building it all over by yourself! You may do it for fun or even to refresh your basic C skills
I'm doing this tutorial myself, it's so easy to follow. If you want to know the story behind its creation see the authors blog post about it
#c #tui #kilo #editor
https://viewsourcecode.org/snaptoken/kilo
Kilo is a text editor written in C with <1000 lines of code (Thats why it's called a Kilo)
The link above is a step by step walk through of building it all over by yourself! You may do it for fun or even to refresh your basic C skills
I'm doing this tutorial myself, it's so easy to follow. If you want to know the story behind its creation see the authors blog post about it
#c #tui #kilo #editor
Just got rick rolled by svelte tutorial
Svelte is a lightweight and fast javascript framework used in front-end. similar to react but apparently easier to learn.
https://svelte.dev/
#javascript #js #svelte #frontend
Svelte is a lightweight and fast javascript framework used in front-end. similar to react but apparently easier to learn.
https://svelte.dev/
#javascript #js #svelte #frontend
svelte.dev
Web development for the rest of us
Zoxide, a better cd command
https://github.com/ajeetdsouza/zoxide
I've been using zoxide for some time now, it's simple yet effective
for example if you use
instead of
Zoxide will remember the path and next time you could use
to end up in the same directory
#shell
https://github.com/ajeetdsouza/zoxide
I've been using zoxide for some time now, it's simple yet effective
for example if you use
z path/to/mydir
instead of
cd path/to/mydir
Zoxide will remember the path and next time you could use
z mydir
to end up in the same directory
#shell
GitHub
GitHub - ajeetdsouza/zoxide: A smarter cd command. Supports all major shells.
A smarter cd command. Supports all major shells. Contribute to ajeetdsouza/zoxide development by creating an account on GitHub.
👍4
A useful bit trick I missed till now
You already know how to swap two variables without a third one using addition/subtraction or multiplication/division. But the problem is they can cause arithmetic overflow if the values are large enough.
Another way is to use XOR (exclusive OR) to swap variables like so:
#bit_manipulation
You already know how to swap two variables without a third one using addition/subtraction or multiplication/division. But the problem is they can cause arithmetic overflow if the values are large enough.
Another way is to use XOR (exclusive OR) to swap variables like so:
x = x ^ y
y = x ^ y
x = x ^ y
#bit_manipulation
🔥1
bc, which stands for basic calculator, is a..... basic calculator.
It's already installed in your linux system and can be used via your terminal. It takes raw infix expressions like below and evaluates them
Actually it's not just a cli application, it's a programming language! You can create a
Now we can run the program with bc fact.bc and use the following expression:
As you can see f is now recognized. It might not seem much but it will come in handy for simple math/programming problems. You can also define functions as you are giving your inputs to bc (like a repl).
#shell
It's already installed in your linux system and can be used via your terminal. It takes raw infix expressions like below and evaluates them
2 * 3 / (5 - 4) * 2
Actually it's not just a cli application, it's a programming language! You can create a
.bc file, give it to the program and then use it. A bc file sample for factorial function:define f(x){
if(x <= 1) return (1);
return (f(x-1) * x);
}Now we can run the program with bc fact.bc and use the following expression:
2 * 3 / f(3)
> 1
As you can see f is now recognized. It might not seem much but it will come in handy for simple math/programming problems. You can also define functions as you are giving your inputs to bc (like a repl).
#shell
Both bc and dc (a reverse polish notation calculator) were mainly developed by Lorinda Cherry, A computer scientist who had spent her time in Bell labs and also has developed eqn.
Lorinda passed away in 2022
Lorinda passed away in 2022
A very basic problem from project Euler to get started with dynamic programming:
https://projecteuler.net/problem=67
https://projecteuler.net/problem=67
projecteuler.net
#67 Maximum Path Sum II - Project Euler
A website dedicated to the fascinating world of mathematics and programming
❤1
How should you decide between divide-and-conquer and dynamic programming?
If you are trying to decide between these two you already know your problem has Optimal substructure. Meaning it can be broken into smaller problems and solved by combining the optimal solutions of these subproblems.
Now in order to find out which solution is more suitable you should see if it has Overlapping subproblems or not. A problem has overlapping subproblems when its solution might try to solve some subproblems more than once rather than generating new ones. For example if you go with a divide-and-conquer approach to generate a Fibonacci sequence, you'll be solving overlapping subproblems. e.g.:
F(6) = F(5) + F(4)
Both F(5) and F(4) are gonna try and solve for F(3) separately
In summary:
Going for devide-and-conquer or dynamic programming is normally a good decision if the problem has Optimal substructure.
Going for dynamic programming is normally a good decision if the problem also has Overlapping subproblems.
If you are trying to decide between these two you already know your problem has Optimal substructure. Meaning it can be broken into smaller problems and solved by combining the optimal solutions of these subproblems.
Now in order to find out which solution is more suitable you should see if it has Overlapping subproblems or not. A problem has overlapping subproblems when its solution might try to solve some subproblems more than once rather than generating new ones. For example if you go with a divide-and-conquer approach to generate a Fibonacci sequence, you'll be solving overlapping subproblems. e.g.:
F(6) = F(5) + F(4)
Both F(5) and F(4) are gonna try and solve for F(3) separately
In summary:
Going for devide-and-conquer or dynamic programming is normally a good decision if the problem has Optimal substructure.
Going for dynamic programming is normally a good decision if the problem also has Overlapping subproblems.
👍2🍓1
In case you missed it, dylanaraps an open source contributor known for creating neofetch, kisslinux, fff and a few other famous projects, archived and abandoned all of his repos two months ago and left the following message on his github readme:
There is also a funny thread of reactions to his commit:
https://github.com/dylanaraps/dylanaraps/commit/811599cc564418e242f23a11082299323e7f62f8
https://github.com/dylanaraps/dylanaraps/commit/811599cc564418e242f23a11082299323e7f62f8
😁1🐳1