Skip to content

Instantly share code, notes, and snippets.

@user21944
user21944 / .gitkeep
Created November 16, 2020 14:21
.gitkeep
@user21944
user21944 / debian.txt
Created April 6, 2021 13:56
[!] Configuring popularity-contest
┏━━━━━━━━━━━━━━━┫ [!] Configuring popularity-contest ┣━━━━━━━━━━━━━━━┓
┃ The system may anonymously supply the distribution developers with statistics about the ┃
┃ most used packages on this system. This information influences decisions such as which ┃
┃ packages should go on the first distribution CD. ┃
┃ ┃
┃ If you choose to participate, the automatic submission script will run once every week, ┃
┃ sending statistics to the distribution developers. The collected statistics can be viewed ┃
┃ on https://popcon.debian.org/. ┃
┃ ┃
┃ This choice can later be modified by running "dpkg-reconfigure popularity-contest" ┃
#\
i\
n\
c\
l\
u\
d\
e\
\
<\
@user21944
user21944 / pfetch-no-palette-newline.diff
Created June 2, 2021 19:01
Patch pfetch to not print a newline after the palette display.
diff --git a/pfetch b/pfetch
index 039a898..9d350a1 100755
--- a/pfetch
+++ b/pfetch
@@ -1038,10 +1038,8 @@ get_palette() {
palette="$palette$e"
}
- # Print the palette with a new-line before and afterwards.
- printf '\n' >&6
@user21944
user21944 / mkmit
Created May 16, 2022 23:15
Bash/zsh function to generate a copy of The MIT License
#!/bin/bash
mkmit() {
[[ -e LICENSE ]] && printf "A LICENSE file already exists\n" && return
cat << EOF > LICENSE
MIT License
Copyright (c) $(date +%Y) $([[ -n $1 ]] && printf "%s " "$@" || whoami)
@user21944
user21944 / middle_square_method_hex.c
Last active June 26, 2023 21:58
Middle-square method pseudorandom number generator, modified to use hex digits and works with seeds of any length.
#include <stdint.h>
#define DIGITS 4 /* number of bits in a hex digit */
static inline uint64_t hex_digits(uint64_t n);
uint64_t hexmsm_next(uint64_t n)
{
uint64_t seedlen, sqrlen;
seedlen = hex_digits(n);
n *= n;
sqrlen = hex_digits(n);
@user21944
user21944 / string-factorizer.py
Created November 9, 2022 18:02
Find the greatest whole number factor pair (with remainder) for each decimal character in a string. Useful for writing characters to memory in brainfuck.
string = [*input()]
for i, char in enumerate(string):
string[i] = ord(char)
# print(string)
def factorize(n):
x = 0
y = 0
for i in range(2, (n // 2) + 1):
@user21944
user21944 / brainfuck-string-generator.py
Created November 10, 2022 21:46
Encode a string as brainfuck instructions to be contiguously written to memory (and optionally outputted)
string = [*input()]
for i, char in enumerate(string):
string[i] = ord(char)
# print(string)
def factorize(n):
x = 0
y = 0
for i in range(2, (n // 2) + 1):
@user21944
user21944 / Bruh!.b
Created December 22, 2022 13:54
Bruh!
>>++++++++[<++++++++>-]<++>>++++++++++[<+++++++++++>-]<++++>>++++++++++[<++++++++++++>-]<--->>+++++++++[<+++++++++++>-]<+++++>>+++++[<++++++>-]<+++<<<<<,[>.>.>.>.>.<<<<<,]