Skip to content

Instantly share code, notes, and snippets.

@LinArcX
LinArcX / init.c
Created November 5, 2023 22:17 — forked from rofl0r/init.c
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@LinArcX
LinArcX / gist:0eb5487108f7817c247aa21066885d85
Created August 24, 2023 09:44 — forked from junegunn/gist:f4fca918e937e6bf5bad
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@LinArcX
LinArcX / Winsock2Server.c
Created July 10, 2021 16:15 — forked from smvd/Winsock2Server.c
Simple HTTP server code
/*
- Read code from files
- Show images
- Show json
- Show video
- Show audio
- Better debugging
*/
#include <stdio.h>
@LinArcX
LinArcX / cheat_sheet.txt
Created July 9, 2021 11:01
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@LinArcX
LinArcX / html5TagSyntax.bnf
Created December 13, 2020 16:29 — forked from tkqubo/html5TagSyntax.bnf
EBNF notation for HTML5 tag syntax
tag-open := '<' tag-name ws* attr-list? ws* '>'
tag-empty := '<' tag-name ws* attr-list? ws* '/>'
tag-close := '</' tag-name ws* '>'
attr-list := (ws+ attr)*
attr := attr-empty | attr-unquoted | attr-single-quoted | attr-double-quoted
attr-empty := attr-name
attr-unquoted := attr-name ws* = ws* attr-unquoted-value
@LinArcX
LinArcX / trans-cached.sh
Created November 12, 2020 20:13 — forked from fdietze/trans-cached.sh
Cache `trans` translation results in sqlite
#!/usr/bin/env bash
set -Eeuo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/#:~:text=set%20%2Du,is%20often%20highly%20desirable%20behavior.
shopt -s expand_aliases
SOURCE_LANG=$1
TARGET_LANG=$2
TEXT=$3
ENGINE=${4-google}
CACHEFILE="$HOME/.cache/trans_cache.sqlite"
@LinArcX
LinArcX / orthodoxc++.md
Created August 16, 2020 07:36 — forked from bkaradzic/orthodoxc++.md
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@LinArcX
LinArcX / repo-reset.md
Created March 7, 2020 09:23 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@LinArcX
LinArcX / scrolling_form.c
Created August 12, 2019 14:08 — forked from alan-mushi/scrolling_form.c
This is a simple example of "scrolling" form with ncurses. It use "page" to allow forms with more fields than your window can print.
/*
* This is a simple example of "scrolling" form with ncurses.
* It use "page" to allow forms with more fields than your window can print.
*
* It prints a "label" (inactive field) and a regular field and let you
* "scroll" pages of the form.
*
* How to compile:
* gcc -o test scrolling_form.c -lform -lncurses
*/