Skip to content

Instantly share code, notes, and snippets.

aaronryank

Block or report user

Report or block aaronryank

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aaronryank
aaronryank / rk.pl
Last active Feb 28, 2018
INCOMPLETE RK TO C COMPILER - usage: perl rk.pl < input.rk > output.c
View rk.pl
use Text::ParseWords;
print "typedef void *UNTYPED;\n";
print "#define ARGS UNTYPED args[]\n";
print "#define INT __uint128_t\n";
print "#define STR char *\n\n";
my @variables;
my $variable_count = 0;
my @code;
@aaronryank
aaronryank / c-lambda.bash
Last active Jul 10, 2019
Convert a C function to a lambda via executable strings.
View c-lambda.bash
#!/usr/bin/env bash
read -p "Function return type: " val
if [ "$1" != "mini" ]; then
read -p "Function name: " name
fi
read -p "Function argument list: " list
echo "$val $name($list) {" >f.c
echo "Enter code:"
@aaronryank
aaronryank / ppcg-answers-integers.txt
Last active Jan 15, 2018
Frequency of languages in my PPCG answers
View ppcg-answers-integers.txt
1 ;#
1 ABAP
1 ACL2
1 A Pear Tree
1 ASM
1 Awk
1 Babel
1 BaCon
1 Bob
1 Ceylon
@aaronryank
aaronryank / oeis.bash
Last active Dec 21, 2017
Downloads all OEIS sequence lists and formats them into C arrays
View oeis.bash
#!/usr/bin/env bash
# Downloads all OEIS sequence lists and formats them into C arrays
for i in `seq 1 296700`; do
printf -v s "A%.6d" $i
echo $s >/dev/stderr
echo -n "long long int $s[] = {"
wget -qO- https://oeis.org/$s/list | tr -d '\n' | sed 's/^.*<pre>/<pre>/' | cut -c 7- | cut -f1 -d"]" | tr -d '\n'
echo "};"
done
@aaronryank
aaronryank / quine.exe
Last active Dec 7, 2017
Windows Executable error quine
View quine.exe
The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.
@aaronryank
aaronryank / setup.bash
Last active Dec 8, 2017
Set up a new PC/workstation: wget -qO- https://xf-technologies.github.io/setup | xargs wget
View setup.bash
#!/usr/bin/env bash
# test internet connection
wget -q --spider http://google.com
if [ ! $? -eq 0 ]; then
echo "No internet connection, exiting..."
exit $?
fi
View humansort.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <limits.h>
// Sort it like a human!
// O(2n)
void humansort(int **list, int size)
{
View tc-oisc.md

Subtract and branch if less than or equal to zero (SUBLEQ)

Subtract the contents of address a from the contents of address b, store the result in address b, and if the result is non-positive, transfer control to address c. If the result is positive, execution continues to the next instruction in the code. So subleq a, b, c would be equivalent to:

mem[b] -= mem[a];
if (mem[b] <= 0)
    goto c;

A variant of subleq is subneg, which is equivalent to subleq except instead of mem[b] <= 0 it performs mem[b] < 0.

@aaronryank
aaronryank / simple-tc-languages.md
Last active Oct 3, 2017
Turing-complete esoteric languages that are easily to implement -- for https://gist.github.com/aaronryank/5eff98fe13c4d05c091982daa56d0c23
View simple-tc-languages.md
You can’t perform that action at this time.