[Back]

Blog

sim now has a project page

sim now has a project page

[all poststhis post only]

sim has become big enough to become a project with its own dedicated webpage

The page will serve all the latest tarball releases, as well as patches to customize your version of sim.

It will also be the main news source for the project. New versions will also be announced here, but the project page might offer more insight on the updates.

The first available patch is scheduled to be released alongside version 0.2. More details on the patch will be posted on the project page.

Lastly, I made a 88x31 gif so that you can share sim on your website (and hopefully get more people involved on the project :P)

Share sim on your website!

The Text Editor Sim

[all poststhis post only]

sim is an interactive multi-file text editor designed for screens with monospaced font. It is heavily inspired on the 'vim' and 'sam' text editors, hence the name sim. The main goal of this software is portability. It only depends only on the C89 standard, and tries to minimize the usage of system calls as much as possible, making it easy (or not even necessary) to port to another environment.

The concept of sim was born around a year ago, and since then three versions have been created to test and mature its ideas.

The implementation

In order to understand the concept of sim, we need to first understand the design choices behind it, since sim's implementation is closely related to is behavior.

Strings

Strings are the core of sim. They are dynamically sized arrays of characters that grow in real time according to their need. Every transaction made with a String checks to see if its current allocated size is enough to fit a new character or another String, which makes it an extremely safe to use data structure. Strings are very light, fast and easy to modify, which makes them ideal for File manipulation.

Files

sim is a multi-file text editor. You can easily swap between the 8 concurrent files using Alt+Num or Esc+Num sequences (they are, in fact, the same thing for a computer). There is a global array containing all 8 Files, and a global File variable that points to the current File which is used for most operations on sim. Each file has its own Buffer. The Buffers are defined the same way as the Files, as a global array, with a global pointer pointing to the current Buffer. Each Buffer contains a list of operations like insert(), delete() and change() treated as transactions, much like in a database, which makes it very straightforward to implement undo/redo functionality on the File.

Files have an Address called dot, which although it resembles the sam dot, it is used with a slightly different approach. While moving around, both dot positions will always be the same. This changes in a situation where the first position is used to store the initial cursor location and the second position stores the current cursor location, for example, while selecting text or inserting text.

Each File also has a Frame attached to it. Frames are responsible for displaying and calculating which characters will be shown on screen. They will be covered next.

Addresses and Frames

Unlike traditional text editors, and much like sam, sim does not keep track of any lines on your file. Instead, it relies on the current position of your cursor relative to the file. This has several advantages over the common method of storing strings in an array. First, it uses much less memory than the traditional method, and also it does not impose any limits on how to perform operations on your file.

Say, for example. you wanted to issue a command that changes a expression than spans over multiple lines (a structure declaration, for example). That would simply not be possible on a traditional text editor like vim or ed. Instead, you would have to make your change manually, line by line, according to your needs.

With text editors like sim and sam, that is not an issue, since newline characters are treated just like normal characters. With this method, you can perform any operation, anywhere on the file. In fact, sim does not distinguish between whitespace and normal characters at all, which makes it possible to hover your cursor above a newline character. I believe this is a very important feature, since it makes users more aware of how lines work on text files, and opens up possibilities for easier line manipulation.

But how exactly does sim achieve that? How does it keep track of the file and cursor position over the screen? This is where the concept of a Frame comes in. A Frame is, in its essence, just a list of Addresses. It stores the current File dot position in one of its Address ranges, it then decides if it is better to flush the entire Address cache or to just change the position of the Frame dot, which is not to be confused with the File dot. The Frame dot is just the index on the Address list where the File dot is contained.

Frames are very smart and efficient, and they are intended to call fwrite() only once per update, which is why all the relevant text has to be in the same String. They are able to do this thanks to the blind_reader() and blind_writer() functions. These functions are responsible for blindly "encoding" or "decoding" a single physical line into one or more visual lines. I say "blindly" because they don't really encode or decode anything, they just parse each character, calculate how much space each one will take, and store an Address on a Address list, which can either be a temporary Frame, or directly stored in the File Frame.

The reason Frames are so efficient is because they store no data apart from File positions, so they have a very low memory footprint, and they are extremely fast since they don't care what exactly they are displaying, only how much space it is taking on screen.

The Frame implementation on sim is around 150 lines of code, including the blind_reader() and blind_writer() functions.

The cursor

Now that you have learned about Frames, you can understand how the cursor in sim works. Contrary to most text editors, including vim and sam, sim will always have its cursor placed on a fixed position. By default, it stays in the middle of the screen, but it can be easily modified to switch to any line that you wish to place it. The reason for that is simple and straightforward. While moving around, searching for terms, or writing text, it is ideal to predict where your cursor is going to be, lest you waste your time trying to find out its location. If your cursor is always in the same position, you will never have to worry about finding the next match or trying to adjust for inserting text somewhere else.

While writing this document, I realize how natural this cursor placement feels like, and I have not had a single issue with cursor positioning a single time. With this, you do not need any fancy search highlighting because it is simply not useful at this point. This was the main reason I created sim after all. All those amazing ideas and solutions came after that. It was thanks to these "limitations" that I have figured out very clever ways on how to solve text editing problems elegantly.

In order to get text to display properly, sim has to first calculate the line positions on top of the cursor, and then sim calculates the line positions on it and below it. The reason for that is that sim has to scan the file in reverse, until it either reaches the start of the file or there are enough lines in the cache for sim to feel comfortable before doing a full update. While moving around, sim will usually calculate a few lines more than necessary in order for the program to update less frequently.

Keys

The way sim implements modal editing like vim is by using the concept of Keys. Keys are easily configured by the user in the config.h file. In a Key, each character corresponds to a function, with an optional argument. In the main loop, the Key list defined in config.h is scanned for the specified key, and once it is found, the function associated with it is called, along with the optional argument. By calling a function, you can basically change the entire path of the program. You can create an entirely different new loop inside it to accommodate a new feature or new logic, or you can make a simple command that changes its behavior according to the next keypress.

The Key table is a very powerful feature of sim, which allows its users to create a vastly different feature or program, just by creating a new function and attaching it to a character.

Regardless of its usage, the main loop will always update the frame before calling the next function, which guarantees that there will not be any graphical artifacts or misalignments when the Key function is called. If something weird happens, that's on the function, not the Frame.

This is how all the functionality of sim is implemented: searching, inserting, deleting, doing/undoing, moving, quitting, and anything else. If you want to add something new, the Key table is probably the place you want to start at.

Final considerations

Porting sim

sim is very system independent. However, it still uses a few environment-specific functions, and it also requires VT100 compatibility. If your operating system complies with the posix standard, then you're on luck, you can just compile it and give it a go. If, however, that is not the case (e.g. inferior OSes) then you'll have to either create your own window/terminal querying/manipulation functions. I will not port it to any system that does not support the VT100 escape sequences or does not have posix compliance. You're on your own.

Implementing new features

Some features that most text editors possess have been intentionally left out of the program e.g. (syntax highlighting), since they are deemed either not necessary or they do not follow sim's philosophy (or both, e.g. syntax highlighting). To these much-needed-features-by-some-people, patches can be made to cover their needs. sim will have its own, separate page, alongside all its patches, for easier download and patching. Anyone can submit patches, and their analysis will be much lighter than commits in order to encourage new users to use sim.

Sun, 22 Aug 2021 06:12:16 +0000

Easy communication with XMPP!

[all poststhis post only]

Hi everyone.

I have just created a xmpp account.

It is now published on my main page, and can be used as the main method of communication.

Fri, 30 Jul 2021 11:56:19 +0000

cat.c

[all poststhis post only]
#include <stdio.h>

int
main(int argc, char* argv[])
{
	char buf[4096];
	FILE* f;
	int i, n;

	for (i = 1; i < argc; ++i) {
		if (*argv[i] == '-' && *(argv[i]+1) == '\0')
			f = stdin;
		else {
			f = fopen(argv[i], "r");
			if (!f) {
				perror(argv[i]);
				return 1;
			}
		}
		while (n = fread(buf, 1, sizeof(buf), f))
			fwrite(buf, 1, n, stdout);
	}
}
Thu, 08 Jul 2021 21:14:04 +0000

net - unix's (unofficial) default network manager

[all poststhis post only]

Meet net, Unix's unofficial default network manager.

It is the simplest (yet very possibly the most powerful) network manager ever created.

net is more about the concept rather than the implementation.

Here's how it works: All network configuration is stored inside /etc/net. Files will be used to store information about ip, mac, gateway and master. These files are called attributes, and they are specific to each device.

By default, devices are configured by creating a directory with its name under /etc/net. e.g. all attributes under /etc/net/eth0 will be specific to the eth0 interface.

If a device is defined in /etc/net, but it does not exist in your system, it is going to be automatically created as a bridge, which can then be set as a master to another interface.

If an attribute is stored directly in /etc/net, it will be applied to the default interface, which is going to be guessed by net. Since most personal devices only have one ethernet port, this can be used to make a very simple network configuration under /etc/net.

This is my personal network configuration currently:

/etc/net/gw
/etc/net/ip
/etc/net/mac

Optionally, if you do not provide an ip address, net is going to automatically fallback to a dhcp client. This is great for personal notebooks or terminals that you change location very often.

Due to its simplistic nature, it also works with wireless devices. The only difference is that instead of plugging a ethernet cable on your wireless receiver (duh), you're going to use a program (e.g iw or wpa_supplicant) in order to establish a connection to the router.

This concept is so simple, yet so effective, that it is hard to understand why this has not been done before, and why it is not the norm.

Advantages:

Disadvantages

Fri, 02 Jul 2021 16:36:54 +0000

The 2fa security circus

[all poststhis post only]

This is a support ticket I sent to twitch a few days ago. It did not solve anything, my issue was ignored, but I still thought it would be interesting to post it here.


Look, I just need to create a script that will show me my real-time viewer count on my streams. Unfortunatelly, I need to use the Twitch API for that. Unfortunately, the old API has been deprecated and does not work anymore. Unfortunatelly, I need to register an app to use the Twitch API. Unfortunatelly, I need to enable 2fa to register apps on Twitch.

Here's the thing, I don't have a phone. I can't use 2fa.

I do not understand this assumption that you guys believe everyone has/must have a phone. Come on, you're better than assuming stuff like this.

I also do not understand why exactly would a phone make my account more """"""secure"""""". I am the world's smartest, most dangerous hacker and I am unhackable. My passwords are never typed, they are 4096 bit PGP RSA encrypted keys that can only be unlocked by a longer-than-48 byte password that I have to type in every time I want to access any password of any account I have ever registered. Whenever I close my browser, all cookies are deleted and account information is lost.

My accounts have never been hacked, and 2fa is not going to make it any different. Unless you plan on leaking your database, I'm 210% positive this account is never getting into anyone's hands. Good luck getting access to my computer while I keep an active eye tracking all connections my computer is making at realtime with netstat -tuapnc and a kernel compiled without IPv6 support, given that you have to be lucky enough to figure out which program currently has my password cached in RAM (IF any) in less than 3 seconds, depending on my reaction time, before I add you to my blocklist.

Hell, I am so secure, that I can even tarball my entire password encrypted directory as they are in my disk right now and just send it in this support ticket, or even to the entire internet. You guys will never see a single byte from them.

I request that you share this message with all your higher-ups on twitch. I want everyone to see this until I'm able to get my viewer count without having to register for that retarded 2fa security fantasy circus. I am going to become twitch's #1 streaming hacker and programmer, and I demand at least the basic analytics without being a cuck to the smartphone culture and treated like a child who has just been furni scammed on habbo.

I just need to get my real-time viewer count reliably on my script, so that it gloriously shows up on my terminal in my second monitor using curl every 5 seconds. I fail to understand why a real API would demand a jking phone for that.

This is going to make a great post in my personal website, please do check it and subscribe to my RSS so you can read it later at https://ssnf.xyz (I also share all of my programs there, on my git server. Feel free to get anything from it).

Yes, it has to be in a script, using curl.

Yes, I just sent all of my passwords as an attachment. Feel free to crack them, losers.


Tue, 22 Jun 2021 16:58:15 +0000

The sim text editor is now on my git server

[all poststhis post only]

I've just uploaded the current version of the sim text editor to my git server.

It is still very much a work in progress, it doesn't really do anything right now.

As always, feel free to rip and tear it from my website, or even the entire website itself.

Tue, 22 Jun 2021 16:45:47 +0000

Minimalistic Doom v0.1 released

[all poststhis post only]

I just pushed the latest Minimalistic Doom's commit to my git server.

Feel free to download and test it!

If you find any issues, please report to ssnf@ssnf.xyz.

Mon, 21 Jun 2021 01:22:05 +0000

New Git server

[all poststhis post only]

You can now clone git repositories directly from my website. Currently, I have made available only sbar's source code, but I plan on adding more during the week

You can browse the source code of all my projects at git.ssnf.xyz.

Tue, 15 Jun 2021 07:07:57 +0000

A case against C++

[all poststhis post only]

It has come to my attention that not only C++ is a horrible language itself, but the users of this absoultely horrific language are also retarded.

There is an entire community of programmers that revolve around academic masturbation: making programs to prove they know how to use X feature or Y theory from Z language, instead of actually thinking about the program. Keep in mind that this is not only an issue with C++. However, C++ has this as a built-in feature, and here is what I mean by it;

The following are all code excerpts taken from REAL programs. Things that are actually used unironically by people, "randomly" chosen (yy'd from vim):


	std::vector<std::string> execute;
	std::array<bool, 8> smoketest;

	int
	main(int _argc, char *const *_argv, char *const *const _envp)
	noexcept try
	{
	...
	}
	catch(const std::exception &e)
	{
	...
	}

	auto escapedPropEnd = std::copy_if(node.propsBegin, node.propsEnd, propBuffer.begin(), [&lastEscaped](const char& byte) {
		lastEscaped = byte == static_cast(Node::ESCAPE) && !lastEscaped;
		return !lastEscaped;
	});

Here is the non-retarded version:


	char** execute;
	bool smoketest[8];

	int
	main(int argc, char** argv)
	{
	...
	}

	while (node.propsBegin != node.propsEnd)
		if (byte != '0xfe') *propBuffer++ = *node.propsBegin++;
	escapedPropEnd = propBuffer;

Honestly, I still don't completely understand that C++ code because of how littered with garbage it is, but you get the idea. You can also mess around with indentation and whitespace on the code I wrote however you like.

In C++, not only you're allowed to make such a messy syntax, you're also encouraged to do it. It is unreadable, to the point where even the author has to squish his eyes to understand what the actual fuck that piece of code does. This brings me to my next point.

There reaches a point where the code people write is so hard to understand, they must litter the entire program with comments. I strongly advocate against comments: they are useless and, most of the time, they are even wrong.

Defenders of commenting code, however, are as dumb as they get. They see this problem in a totally inverted way. They see over-engineered code as a unavoidable thing, so commments are needed to clarify code. I say no. Code, in the first place, should be simple. Comments are not good to understand code. Code is good to understand code. Code is the ultimate truth. Fuck off John and his imagination, what matters is what is actually written. Adding comments stating your intention only proves how dumb you are.

My main questions are: why use/create a new method to do something that already exists? Why use std::array when your language already provides you with arrays? Why use a comparison function if you can already make comparisons? Do you not understand how to use 'if' or 'else'? Why keep memorizing all of those standard library functions and what each of them do, instead of making actual code? What are you afraid of, really?

For any REAL programmer, it is easy to see... actually no. It is hard to understand why. Why would someone opt to use this syntax garbage? What is the driving force behind making something simple... complex?

Although we all know the answer, it's kind of annoying to keep repeating it, and it is even sad that it is a reality. People over-engineer stuff because they are dumb. They over-engineer because they want to hide how dumb they are from people who know less than them, and therefore they make their code a convoluted mess.

There are just two small problems with that. First of all: you're not hiding how retarded you are to someone who knows more than you. If you want to impress someone, it should be your superiors, not someone who doesn't care about your funny text on the screen.

Second: you're making it hard to maintain your codebase. If you care so much about "future-proofing" or "standing the test of time": MAKE. IT. SIMPLE. Let new people look at your code and not waste time figuring out what it was supposed to do.

People memorize because they cannot think. People who cannot think are plainly dumb. Or maybe I'm just too dumb to be retarded. It is hard for me to think like an idiot.

I think that's about all I had to talk about C++... for now. I honestly get more and more pissed every time I have to read C++ code from some program, and I always end up rewritting it in C for me to actually be able to read it.

Remember kids, code is made for computers, not humans. So learn how to think like a computer, not the other way around. Unless you're too dumb to figure that out.

mail produly written without spelchckeksss

Thu, 15 Oct 2020 00:32:51 +0000

Search engine maintenance

[all poststhis post only]

In the next few months, I'll start rewritting the search engine that is currently serving this website from scratch.

Searx is bloated and made on Python, which is absolutely garbage. I have no idea why people keep making big projects on a scripting language

In the meanwhile, I'll try to keep a temporary searx instance running.

Mon, 31 Aug 2020 00:26:43 +0000

New website, search engine, and RSS feed!

[all poststhis post only]

I've created this website as the foundation for my 'web independence'. Sounds crazy, right? Well, not for me. And here's why.

Over the past few years, privacy has become a huge concern for me. I started doing the simple steps: leaving social media, using "private" search engines, using privacy-focused browsers or extensions, using VPNs, Tor and whatnot. But it just *wasn't* enough. It never really is. I still watched a lot of youtube videos, I still had PLENTY of accounts in a lot of websites, with a GMAIL e-mail AND, worst of all, I still have a phoneâ„¢, the ultimate, consentless privacy breaker. Needless to say, it didn't matter how hard I 'fought.

So, in the past few days, I've been thinking about ways to get rid of my two main privacy breaking problems: e-mail and phone. Inspired by Luke Smith (thank you for the tools), I created this website for one purpose: so that people could easily contact me in the absence of my phone number.

I'll always keep the best way of contacting me in this website. Right now, the best way is to send me mails on ssnf@ssnf.xyz (nifty, eh? Short and simple)

This site actually has quite a few cool functionalities, one of them being a meta-search engine. Nothing is exactly final, I'm still going to deploy more functions to it. But it is completely usable and functional, so please do use it!

There are no logs and the code is completely open source, so you can check it yourself and see that I'm not lying. The advantages are clear: more privacy, more freedom, less censorship. You'll get results that google doesn't show you on purpose. The more people use it, the better. If only one person was using it, it would be pretty easy for google and friends to build a profile on him. But if everyone is using it, we all stay private! It's a win-win situation! (plz don't overload my servers :p)

Maybe the idea of privacy doesn't matter to you, but hey: A meta-search engine is way better than any search engine! In just ONE single place, you can search for youtube videos, torrent files, scientific articles, books, all in ONE search bar! How can you not be convinced yet? Come use my searx engine!

I have also created an RSS feed for the website, should anyone wish to follow these posts.

I also intend to create a repository for my projects inside this very website. So all my public code will be shared with everyone here. (Remember, no social media, so Github/Gitlab will not get any code from me... yet).

On a final note, the design of the website is intended to be final, and there are a few reasons for that. First one is my eyes. Recently I've been having minor headaches from looking at bright screens, so the black background with gray-ish text works the best for me. Second one is to KISS (Keep It Simple, Stupid). Honestly, maintaining a website like this is so much easier. It's simple, it's fast, it's intuitive. No php and no javascript (fuck you javascript, fuck you.), only plain html and css. I can focus on actually adding content to it, instead of making it look "pretty". In fact, this looks really pretty to me already, and I don't even need to use a GUI browser to see it (ew!), I can just log into any terminal, launch w3m or lynx and there I go.

Might become a trend one day, who knows.

Thu, 25 Jun 2020 04:51:46 +0000