Skip to content

Instantly share code, notes, and snippets.

@Low-power
Low-power / freebsd-10-mulitboot-compliant-kernel.diff
Last active May 24, 2019 07:16
FreeBSD 10 Multiboot kernel image
An experiment to make a Multiboot-compliant kFreeBSD i386 image.
Copyright 2019 Rivoreo
Added code are released under the FreeBSD license (2-clause).
diff -ru --exclude-from freebsd-src-diff-exclude-names --new-file a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c
--- a/sys/boot/common/load_elf.c 2016-03-25 09:09:27.000000000 +0800
+++ b/sys/boot/common/load_elf.c 2019-05-15 18:46:30.670084560 +0800
@@ -161,6 +161,9 @@
Elf_Ehdr *ehdr;
int err;
/* Copyright 2015-2022 Rivoreo
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@Low-power
Low-power / install-cad-warning.sh
Last active July 7, 2020 06:12
Ctrl-Alt-Del warning for systemd.
#!/bin/sh
# Ctrl-Alt-Del warning for systemd.
# Override default CAD action of rebooting system.
# Copyright 2015-2020 Rivoreo
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@Low-power
Low-power / ifconfig.sh
Created October 25, 2019 09:39
Interface datalink layer configuration tool for Linux
#!/bin/sh
# Copyright 2015-2019 Rivoreo
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
@Low-power
Low-power / clear-all-vnodes-text-flag.gdb
Created October 29, 2019 07:46
kgdb(1) script for clearing VV_TEXT flag from every vnode in kFreeBSD
# This file has no copyright assigned and is placed in the Public Domain.
# No warranty is given.
# Usage: kgdb -w < clear-all-vnodes-text-flag.gdb
set $p = mountlist.tqh_first
while $p != 0
set $v = $p->mnt_nvnodelist.tqh_first
while $v != 0
if $v->v_type == VREG
#!/bin/sh
# Put followings into /etc/crontab
# LANG=C.UTF-8
# LC_TIME=C
# 10 8 * * 1 root dt=`date +\%F.\%H-\%M` && tmux -L download-and-build-gcc-10-snapshot new-session -d "exec script -t -c 'exec sh /home/src/download-and-build-gcc-10-snapshot.sh' /home/src/download-and-build-gcc-10-snapshot.log.$dt 2> /home/src/download-and-build-gcc-10-snapshot.log.$dt.time"
set -x
set -e
GCC_SNAPSHOT_URL=http://ftp.tsukuba.wide.ad.jp/software/gcc/snapshots/LATEST-10/
#!/bin/sh
# Copyright 2015-2021 Rivoreo
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@Low-power
Low-power / droptostop.c
Created April 22, 2020 09:17
LD_PRELOAD program used to prevent terminals from being write-protected by foreground process.
/* This file has no copyright assigned and is placed in the Public Domain.
* No warranty is given.
*/
#include <termios.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef LIBC_PATH
@Low-power
Low-power / logcat-color.sh
Last active February 25, 2023 00:37
Fast, ash-compatible reimplementation of Anthony's logcat-color.sh
#!/bin/sh
# Colorize logcat(1) output
# Copyright 2015-2020 Rivoreo
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to