Skip to content

Instantly share code, notes, and snippets.

@iacore
iacore / why3.rb
Created September 3, 2021 06:59
why3 file line number rewrite (to be used with vscode or other ide)
#!/usr/bin/env ruby
def rewrite(rd, wr)
rd.each do |line|
line = line.gsub /File "(.*)", line (\d+), characters (\d+)-(\d+):/, 'File \1:\2:\3 to \4'
wr.puts line
# wr.flush
end
end
@iacore
iacore / instructions.txt
Last active November 1, 2021 15:16
How to Uninstall Nix
Uninstalling nix:
1. Delete the systemd service and socket units
sudo systemctl stop nix-daemon.socket
sudo systemctl stop nix-daemon.service
sudo systemctl disable nix-daemon.socket
sudo systemctl disable nix-daemon.service
sudo systemctl daemon-reload
2. Restore /etc/profile.d/nix.sh.backup-before-nix back to /etc/profile.d/nix.sh
@iacore
iacore / koka.ohm
Created January 17, 2022 16:40
Koka Lex Grammar written in Ohm
Koka {
space := "\x01".."\x00" // disable builtin rules
spaces := ""
program = token*
token = whitespace | lexeme
whitespace = white | newline
newline = "\r"? "\n"
white = " " | blockcomment | linecomment | linedirective
@iacore
iacore / info.md
Created May 16, 2022 19:28
How to get alternate screen in terminal application

Use scrollback buffer

If terminal doesn't have a seperate screen buffer, but allow cursor movement, you can use new linereturn to create the new "screen", not touching the scrollback buffer above.

#############################
###### previous buffer ######
#############################
#############################
#############################
@iacore
iacore / readme.md
Last active May 30, 2022 16:31
Async run times in Rust
  • SIGSEGV proof: able to handle SIGFPE/SIGABRT/SIGSEGV (ususally cause by calling c library)
name Panic proof SIGSEGV proof
tokio (tested with xtra) Yes; thread 'tokio-runtime-worker' panicked No
bastion Yes; error with tracing No
import Data.Colist
InfiniteBits : Type
InfiniteBits = Colist Bool
-- 1.bits << n
record RealData where
constructor MkRealData
n: Int
bits: InfiniteBits
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions: [p6, pm6, pod6, raku, rakumod, rakudoc, rakutest, nqp, crotmp]
scope: source.raku
contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
@iacore
iacore / ConstCaller.rakumod
Created June 22, 2022 21:09
use "constant" function sigilless
=begin pod
Example Usage:
=begin code
use OpenGL::GLFW:from<Perl5> qw<:all>;
use lib ".";
use ConstCaller;
constant GLFW = ConstCaller.new :package(OpenGL::GLFW.WHO) :prefix<GLFW>;
@iacore
iacore / testimg.nim
Created June 30, 2022 09:40 — forked from demotomohiro/testimg.nim
Realtime pixel drawing
import std/[strformat, strutils, bitops]
import pixie, chroma
# define `nort` when opengl or windows system is not available.
when not defined(nort):
import nimgl/[glfw, opengl]
proc `{}`(image: var Image, x, y: int): var ColorRGBX =
## Accessing any pixels outside the bounds of the image is error
when not defined(danger):
@iacore
iacore / .gitignore
Last active December 8, 2022 19:35
katla runner
out/