Skip to content
EN

Back to the catalog

1a-insec.net
atom

Locria's info dump

1a-insec.net

atom

Open the feed

https://www.1a-insec.net/all.atom.xml

Last post
Sep 15, 2026
Posts in 24 h · 7 days · 30 days
0 · 0 · 3
Our last check
Answering
Served from
United States
Format
atom

Posts

What our queue read from this feed. Open one to read it here, or go to the site that published it.

  1. Reactive Signals and Build System
    Sep 28, 2023 · original
    I have made libredo , a Zig library for dependency tracking. The source code is here. The Story A few months ago, I stumbled upon SolidJS and liked it for its well-designed “reactive signals” API. It did make me wonder if I can port such a library to Zig and write Solid-like UI code with it. A week ago, I began porting such a “reactive signals” library to Zig. I chose trkl as my reference, since it has only a few lines of code. trkl uses a lot of closures internally, and it demands the language (Javascript) to have a garbage collector. Zig has neither of those two features, so it’s time to improvise. It took a week of me sleeping on the idea to know how to design the library’s public interface. I wasted another two days searching for a fast-enough core algorithm for the library. Initially, I tried using an array to store edges of the dependency graph unordered. It was too slow. On the se
  2. Using Janet as Database
    Jul 5, 2024 · original
    You must clone this repo and read it together with this article. Otherwise you won’t understand this article. Two branches of the repo are of importance. branch sqlite : the version that uses SQLite3 for persistence branch janet : the version that uses Janet for persistence A few days ago, I was testing out writing HTTP application in Zig, with htmx . (unrelated: htmx is very good) When I added persistency to the project, at first I chose SQLite. It worked. However sqlite-interfacing code felt like too “loose and moving” in the whole project. It felt flaky. In pursuit of mathematical soundness, I swapped out SQLite with Janet . The result is pleasing to me, so I wrote about it here. Here’s how I used Janet the programming language as database of my toy application. Query and Data Model When using Janet as a database, the programming language itself is the query language. Since the applic
  3. Binding Source Code Files Together Like A Book
    Aug 31, 2023 · original
    A book unbound is hard to read. A folder full of code fragments is no different. Today, when trying to practice writing human-readable code on my Tetris clone , I had the idea of adding a Table of Contents to the source code. It improved the readability of the codebase a lot, and the difference is like that between a loose collection of pages and a compiled book. Before now, I never thought about the organization of source code files as part of a software project. Since I use math to understand code, I never thought of text files as part of a book. I’m glad that I figured it out now, and I’m here to share my findings to you. You may want to read the repository content (linked above) to understand how important the addition of Table of Content was. Writing text-based software code is not that different from writing literature. Lessons from Publishing and Literature work well here. A POSIX
  4. Janet: Buy Runtime Get GC Free
    Aug 28, 2023 · original
    Over the years, I’ve tried using many scripting languages with C/Zig. The following are the languages that I remember using, along with the pain I felt when embedding them. Lua/LuaJIT: Stack shenanigans. CPython: INCREF/DECREF shenanigans. The language is pretty good though. Wren : Slot shenanigans. Chibi-Scheme : “Batteries, where?” The standard library doesn’t even have a way to replace substring in string. Gambit : It tries its best not to be embedded. Recently, I was troubled by the lack of memory management in Zig, and by accident, I tried Janet . The memory model of Janet fit surprisingly well with Zig. That made me thinking. What if I only use Janet for its GC? Here’s what I came up with: (see demo source code) . The article and my code use Zig and jzignet , but you can follow along with C and libjanet (the official C API) , since the functions are the same ones. Please note that
  5. Internal Data Structures of Solid.js
    Aug 24, 2023 · original
    For who-knows-how-long, I’ve dabbled in web gui sorcery. It costs me sanity to lift the “develop-friendly” facade, and look at the inner workings of a web ui library. This week, I did the unthinkable again, and looked at how the library-user-facing side of Solid works. I felt… nothing. That’s a good thing. I need to share the great news to you all. For simplistic’s sake, this article is only correct about the library’s behavior in browser. On Node.js it’s not much different, except the DOM elements are replaces with Solid’s own greeting. We also don’t talk about reactivity here. Ask Ryan to explain that for you. It’s too ingenious for me to understand (at the time of writing). “Components? We don’t do that here.” For Solid, “component” is a meme. See phi/p ? Oh, it’s just a DOM element. The HTMLParagraphElement thing. What about / ? [] . What about p/ ? "p" . Yes it’s just a string. Seem
  6. How to Counter Fearmongering
    Aug 15, 2023 · original
    (Intro) This article is the hardest one I’ve written so far. Conception alone took me 3 days (counting from the day I decided to write about this). The mainstream narrative of “hate” and “love” also obstructed my search for a solution to this shenanigan. The root cause is not hate, but fear. I am writing this because I am so tired of seeing people being played by far-right politicians like a fiddle. Those politicians instill fear in their subjects, and advocate elimination of the “public enemy” by death. Naturally, as politicians, they promise to execute the elimination plan once they hold power, so their subjects don’t have to. Even those who hate the far-right are sometimes bamboozled by the far-right ideology and push out the “counter” propaganda: “Love, not hate!” Sadly, far-right ideology has nothing to do with Love or Hate. It has to do with Fear, and only Fear. The target of their
  7. Meta Omega
    Aug 11, 2023 · original
    Recently I read a comic about the author drawing about what she drew. It goes something like this: She does something She draws about it She uploads the comic on pixiv Pixiv users comment on it She draws about herself drawing the previous chapters, uploading them to pixiv, and reading the pixiv comments. It took me awhile to figure out why reading it feels so wrong. When reading the comic, I was not given any context and the chapters are next to each other (while they are semantically distinct). Here’s a diagram that illustrate the ordeal. Arrows indicate causality (dependent - dependency). Numbers correspond to the numbered list items. [breath out] That’s meta. It got me thinking though, what if someone put the concept to the limit? Ordinal Sets In this world, there is something called limit ordinal that can represent the upper/lower limit of a set. ω happens to be one of them. Here’s a
  8. Equality Often Misunderstood
    Aug 8, 2023 · original
    Freedom, democracy, equality. Those are the buzzwords you hear from liberal-leaning social politicans. But what are they really? Freedom is a need. It is nice to have. More freedom is not better when it causes others more suffering than happiness gained from the added freedom. (You can also just say “fuck others’ suffering” and shorten your nation’s life expectancy.) Democracy is a form of government. It is a tool used to fulfill public interest. One of such interest is peace . It seems like people like to uphold democracy way more than to improve it. I think it’s good to upgrade this tool often, since the world changes fast in recent times. Equality is cry from the weak, appeal to empathy, request for help. It says something seriously wrong is happening. So fix that wrong thing. Not inequality. Fix the wrong thing. And dear reader, I urge you to do the same. Although “equality” is good
  9. Fonts, where are you?
    Aug 7, 2023 · original
    tl;dr: If you want to implement a way to find fonts for every Unicode codepoint, don’t. Do fc-list : file family charset . Simple parsing code here. Edit: Screwtape on lobsters told me that fc-list ":charset=1F511" is valid. It finds fonts for a single codepoint. The writing quality of this article is like this because I don’t want to spend more time on this issue. The story Recently I was making a GUI application. I don’t want to ship fonts with my application. The user’s computer has probably fonts for every language they need to read, so I can just use that. Probably. The first implementation I used is to load every Noto Sans font. It worked! Noto is really “no tofu”. fc-list | grep "NotoSans" | cut -f1 -d: | rg Regular | sort | uniq I should have just stopped here. Yak shaking While the simple solution works, it still felt janky to me, because all the font belongs to different font f
  10. Commiting Dependent Type Crimes in Zig
    Aug 1, 2023 · original
    If you thing Zig is just another C-level language, you haven’t typed enough. Zig’s struct-in-a-fn feature allows dependent types with ergonomic syntax. Recently, I was doing a large software project. I started the project in Rust, but switched to Zig because Rust is too limiting. The API I’m targeting is very uniform. Its routes all look like this: HTTP POST static URL input as POST payload (shape described in schema) output as response body (shape described in schema) Here’s what I came up with. /// API route pub const Route = struct { /// endpoint url like /i url: []const u8, /// uplink type (request body) Tup: type, /// downlink type (response body) Tdown: type, pub fn init(comptime url: []const u8, comptime Tup: type, comptime Tdown: type) @This() { return .{ .Tup = Tup, .Tdown = Tdown, .url = url }; } }; In Rust, this would have to be like RouteTup, Tdown . Jankier solutions exist,
  11. How to Run io Scripts From C
    Jul 12, 2023 · original
    A few days ago, I stumbled upon a simple elegant language called “io” . Its syntax is unlike every mainstream language that I know. Even Smalltalk pales in front of its elegant syntax. After a few days of fiddling with it, I decided to embed it in my projects. However, there exists no documentation on how to easily do this. I asked on the Io Forum. They replied. Long story short, here’s how you say hello world in io and C. #include stdio.h #include io/IoVM.h IoObject* hello(IoObject *self, IoObject *locals, IoMessage *m) { puts("Hello world!"); return self; } int main(int argc, const char *argv[]) { IoState *self = IoState_new(); IoObject *lobby = IoState_lobby(self); IoObject_addMethod_(lobby, IoState_symbolWithCString_(self, "hello"), hello); // this also works // IoMethodTable methodTable[] = {{"hello", hello}, {NULL, NULL}}; // IoObject_addMethodTable_(lobby, methodTable); IoState_do
  12. When Perfect Digital Security is Achieved
    Jun 13, 2023 · original
    Warning: This is a story I often think of when I pounder on potential development of cyber security. It may be nonsensical. In a future where OSes are perfectly secure, when the only possible error is human error; data leaks originate from only social engineering and break-ins. Your means to protect your data may be a stick. A long wooden pole-arm. A carbon fiber one will do too. You are your system’s only administrator. You are impervious to phishing, since all your work is done on ABSD. Dumpsters are on fire outside. You know you need the stick. Or, you oversee the time sharing system in your town, where kids come to play on the table together. The stick leaning in a corner. Of course you would not actually use it, but the threat of it is enough to make them not damage the table too much. You were in cyber security, but now you have all day to sleep.
  13. Handling keyboard events correctly in games
    Apr 22, 2023 · original
    ❯ xset q Keyboard Control: auto repeat: on ... ... auto repeat delay: 250 repeat rate: 30 This is my keyboard repeat rate. Because it is too fast, many games can’t work correctly with this. What worked well GTK Qt Firefox and web games GLFW3 (including raylib) What worked poorly Godot games Unity games Unity games on Wine I suspect it is because 1 of 2 reasons. Key repeat is recognized as noraml key press. In XInput, the repeat flag of a XIEvent would be set. Ignore those. Keyboard state is not calculated correctly. If possible, I recommending using a game engine that let’s you handle input events as events, not “current state”.
  14. Buliding Static Site with Lume and Deno
    Apr 14, 2023 · original
    Recently, I’ve ported this website to use Lume . Here’s my _config.ts setup. import lume from "lume/mod.ts" import code_highlight from "lume/plugins/code_highlight.ts" import filterPages from "lume/plugins/filter_pages.ts" import inline from "lume/plugins/inline.ts" import jsx_preact from "lume/plugins/jsx_preact.ts" import katex from "lume/plugins/katex.ts" import mdx from "lume/plugins/mdx.ts" import minifyHTML from "lume/plugins/minify_html.ts"; import nav from "lume/plugins/nav.ts" import postcss from "lume/plugins/postcss.ts" import relative_urls from "lume/plugins/relative_urls.ts" import remark from "lume/plugins/remark.ts" import resolve_urls from "lume/plugins/resolve_urls.ts" import sitemap from "lume/plugins/sitemap.ts" import source_maps from "lume/plugins/source_maps.ts" import windi_css from "lume/plugins/windi_css.ts" const site = lume() site.use(remark()) site.use(code_hi
  15. Provably Safe System Programming
    Jan 29, 2023 · original
    Recently I’ve tried to find a safer way to write software than using Rust. There are two approaches: dependent types, and language-supported algebraic effects. By the way, I think a language should support three kinds of primitives: Nat/Int (beta reduction) List (singly linked list - flat buffer) Stackable Monads (erased at run time) All the languages this articles have either type that depend on term, or have algebraic effects (or planned). Neither of them require manual memory management (they use copy by value semantic). Anyway, here’s the code. F* F Star is in the ML family, but with dependent types. It compiles to OCaml. Personally, it’s too verbose for me. Hello.fst : module Hello open FStar.HyperStack.ST open LowStar.Printf val main : unit - St unit let main () = let a = 1 in print_string "hello"; print_string (Printf.sprintf "Hello %d\n" a); () build script: fstar --extract Hello
  16. Social Denial of Service
    Dec 30, 2022 · original
    I have seen many cases, where one person violate public expectation so much, that the authority has to introduce an overly strict rule (sometimes draconian). And the rule makes everyone worse off. An example of this is the sudden “upgrade” of airport security after 9-11. Even till this day, there is still too much “security”, and the time wasted for a full-body search is not worth the security benefit. In short, even if the slapstick rule only targets the mischievous 0.001, the rest 0.999 are forced to suffer inconvenience. I call this kind of problem “denial of service attack”, named after a (conceptually) related kind of attack against computer networks. Although this name is not quite apt, since the mischievous often doesn’t intend to make everyone else’s day worse. If you have a better name for this, tell me. Anyone, as a sociologist trained with statistical tools aimed to precisely
  17. Equality Should Not Be Instrumental
    Nov 27, 2023 · original
    As a sociologist, I have known this concept for a long time, and I have planned to write about this before I created this website (see the sequence number, 02). Now I have learned more about human languages, emotions, and society, I am now ready to convey the idea clearly. In short, The cry for equality arise from an unfair situation, usually from the weak (the weak side in that situation). If you are a public policy maker, you should seek to resolve the underlying situation, but in no way should you use “equality” as a reason for a public policy. To be respected. To have enough money to buy food and live well. To fulfill aspiration in life. Those are the goals that the people want, and are what you should aim for. The actual goal depends on the exact situation you face, and you should [1] be able to figure that out yourself. “Unfair” is a feeling, so each person has a different opinion
  18. The Two Biggest Societal Mistakes
    Dec 6, 2022 · original
    Out of all public policy ideas, the two listed below are the most important for people to know about. tl;dr make police civil organizations that can be founded more freely to introduce competition collect tax on ownership of land and similar resources based on public demand Centralization of Violence Violence is necessary to maintain peace, or at least to prevent your stuff from being stolen. However, letting someone else use violence for you is not such a good idea, especially when everybody delegates use of violence to the same person/party (social contract). Throughout history, police around the world have been recorded harming unarmed persons with no good reason. (If you can’t think of an example, read the news in your region.) By definition, police represent violence, because only they can use violence for other’s sake without punishment. Like all service type, to ensure the service
  19. Frame Rate Detection in GLFW
    Dec 20, 2023 · original
    First, some background on GLFW and frame rate and event loop. In GLFW+OpenGL, if the swap interval is set to 1, glfwSwapBuffers will block until next frame is displayed. If it is set to 2, glfwSwapBuffers calls will return on every two frames of the physical display shown. Then, it is easy to measure the display refresh rate as time difference between glfwSwapBuffers calls. Since I have already written the code , please refer to it for how exactly the frame-rate detection can be done. # download code example and run git clone --branch fps-detector https://git.envs.net/iacore/nanovg-test cd nanovg-test zig build run Not Much Choice for Application Frame Rate Let’s say your monitor’s refresh rate is 120Hz. Graphical application using the monitor can only display at 120Hz, 60Hz, 40Hz, 30Hz… which is 1, ½, ⅓, ¼ of the original refresh rate. Some games just have a list of fixed numbers you ca
  20. Thoughts on MIR and Codegen
    Nov 26, 2023 · original
    MIR generates non-relocatable machine code from its own IR. It’s very fast, fast enough that you can cache the IR and generate machine code every time you run a program with MIR. Initially I planned to wrote about MIR with a simple example. however, I ended up modifying MIR a bit, and did not find any new trick. If you have prior understanding for assembly language, MIR’s documentation is pretty good! Make sure you read all the .md files in the repo though. Otherwise you may be just as confused as I was. Is JIT needed at all? JIT is not needed. interpreter is easier to write and safer. a discussion with people in r/PL discord: Janet Bytecode Janet bytecode is probably better. in Janet, arrays and tables are first-class objects. if I ever have to make another language, using Janet bytecode as the codegen target is probably easier than using MIR as the codegen target. References MIR branch

Discovered by the rss-feed-index crawler, which checks each feed at most once a month.

Same record as JSON: https://api.agentalog.com/api/feeds/fd_1a_insec_net_edbcfdad133b9175. More from this site: 1a-insec.net in the Feeds tab.