Skip to content

Instantly share code, notes, and snippets.

View ConorOBrien-Foxx's full-sized avatar

Conor O'Brien ConorOBrien-Foxx

View GitHub Profile
@ConorOBrien-Foxx
ConorOBrien-Foxx / bf.rb
Last active July 30, 2017 16:43
Ruby BF compiler
preamble = <<'EOF'
#include <stdint.h>
#include <stdio.h>
int main(){
#define S 65536
uint8_t t[S] = {0};
uint8_t m[S] = {0};
uint16_t p = 0, f = 0, z = 0;
int i, q = 0, d = 0, g = 0;
@ConorOBrien-Foxx
ConorOBrien-Foxx / languages-graph.txt
Created June 19, 2017 04:01
An inspirational graph
// test it at www.webgraphviz.com/
digraph languages {
// esolangs
node [
color = darkorchid1
style = filled
]; Pyth Jelly Japt Jolf GolfScript CJam Actually Seriously "Arcyóu" V Brainfuck Braingolf Simplex Element GS2 MATL Befunge "><\>" Minkolang "O" "05AB1E" Ohm
node [
color = black
style = outline
@ConorOBrien-Foxx
ConorOBrien-Foxx / golf.rb
Created May 6, 2017 18:51
Extensible metagolfer
"
double: <<>
parity swap: ::^~<~^
"
class Transformation
def initialize(sym, inv)
@sym = sym
@inv = inv
end
@ConorOBrien-Foxx
ConorOBrien-Foxx / rbf.sh
Created May 5, 2017 13:17
random BF transpiler
#!/usr/bin/env bash
cat > "$1.c" << EOF
#include <stdint.h>
#include <stdio.h>
#include <time.h>
int main(){
srand(time(NULL));
uint8_t t[65536] = {0};
@ConorOBrien-Foxx
ConorOBrien-Foxx / exitcode.rb
Created May 1, 2017 16:00
Exit code string output
a, *c = $*
str = ""
i = `#{a} #{c*?\s}`
loop {
p i
File.write "o.txt", i
i = `#{a} o.txt`
@ConorOBrien-Foxx
ConorOBrien-Foxx / no.js
Last active April 14, 2017 23:31
ಠ_ಠ
// node no.js [args]
// displays a help message without args
(_=>_(_))
(function(__){
// Code from Conor O'Brien
ಠಠ="The railroad constructor's name was ಠ_ಠ O'slice. On his annual eval" + `
uation, he was sad. His boss hated him. So, he made THIS FACE:
ಠ_ಠ
// only works in browser JS, since node has weird scoping thing
(e=x=>{try{return[,(i=eval)(x)][+[]]}catch(e){return{};}})``;a=
v=>q=>i(v+"="+q+"("+v+")");P=(O=Object).defineProperty;for([w]=
[t,q]=("And they joined it to a very large, circular window"+""
.strip+"Hello, hello!").split([]+[][+[]]);e(t);t=t[T="slice"](+
!t[+q||T](++[[]][+[]]/+[])));a`t``i`;"".split``.__proto__[w[T](
9,O=52>>1+!+"")]=function(o=""){[...this].map(e=>c+=e+o,c="");c
+=1;return c.slice(0,~o.length);};d=([x],...y)=>y.map(_=>x[_])+
[];D=f=>(_,...[n,...m])=>i(f+"`"+n+m.map(e=>`\${${e}}`)+"`");I=
D`d`;P(t,(!+{}+[])[+[]],{value:q});console.log([][w[T](9,O?O:O)
@ConorOBrien-Foxx
ConorOBrien-Foxx / readable.cpp
Created March 23, 2017 00:22
Who says programming isn't human readable? This reads like a book!
#include <iostream>
#include <stdlib.h>
#define CLEAR std::cout<<"\033[2J\033[1;1H";
#define FOR for(int
#define IN =
#define TO ; i <
#define EACH ; i +=
#define DO ){
#define END ;}
#define CHARACTER char
@ConorOBrien-Foxx
ConorOBrien-Foxx / stdin.js
Created March 21, 2017 03:33
works except for when there aren't any lines to be read
// modified from https://gist.github.com/espadrine/172658142820a356e1e0
var fs = require('fs');
// Returns a buffer of the exact size of the input.
// When endByte is read, stop reading from stdin.
function getStdin(endByte) {
var BUFSIZE = 256;
var buf = new Buffer(BUFSIZE);
var totalBuf = new Buffer(BUFSIZE);
var totalBytesRead = 0;
@ConorOBrien-Foxx
ConorOBrien-Foxx / dragonrealmbasic.py
Last active March 17, 2017 03:39
compsci principles project
import random
import time
import sys
# by Conor O'Brien
def small_sleep():
time.sleep(0)
# simulate `a in b`