Skip to content

Instantly share code, notes, and snippets.

View thosakwe's full-sized avatar
🎯
Focusing

Tobe Osakwe thosakwe

🎯
Focusing
View GitHub Profile
@thosakwe
thosakwe / find_formats.js
Last active July 3, 2016 19:01
Migration Stuffs
// Still run as sudo
var fs = require("fs");
var path = require("path");
var defaultFormats = [];
defaultFormats.push(/^(.+) (.+):([A-Fa-f0-9]+)->(.+) ([0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}) #([0-9-]+) 1 1$/);
defaultFormats.push(/^(.+):(.+)::(([A-Za-z0-9_]|\.|\/|\$)+)$/);
defaultFormats.push(/^(.+):(.+):([0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}):(([A-Za-z0-9_]|\.|\/|\$)+)$/gm);
@thosakwe
thosakwe / parser.dart
Last active August 15, 2016 11:37
Some parser thing in Dart
foo(stream) {
if (stream.lookahead("if")) {
var ifNode = stream.consume("if");
var elseIfNode = stream.maybe("else if") || stream.maybe("poop")
}
}
var dot = (str) => str.consume(".");
var minus = (str) => str.consume("-");
var parseIf = (str) => str.consume("if");
@thosakwe
thosakwe / fib.lang
Last active October 27, 2016 18:33
Hypothetical funclang
use <filter> as only
use <func> as F
use [Input] of <io>
fn fib(n) {
ret F.decide({
n <= 1 : () => n
}).else(() => F.sum([
fib(n - 1),
fib(n - 2)
@thosakwe
thosakwe / Grammar.g4
Created November 2, 2016 01:11
Pug (nee Jade) with ANTLR
grammar Grammar;
WS: [ \n\r\t] -> skip;
ID: [A-Za-z_] [A-Za-z0-9_]*;
compilationUnit: block*;
block: name=ID '{' (stmt ';'*)* '}';
stmt:
@thosakwe
thosakwe / .stallion
Last active November 2, 2016 01:59
Hypothetical build tool to build OS
mode release {
# Define executables
assembler "i686-elf-as"
compiler "i686-elf-gcc"
bootstrap "boot.s"
link "linker.ld"
sources "src/**/*.c", "path.c"
entry "kernel.c"
grub "menu.grub"
@component()
export default class Layout {
render() {
return div {
this.title(),
this.content()
};
}
}
@thosakwe
thosakwe / README.md
Created November 12, 2016 02:17
Programming in Esperanto?

Esperanto???

Programs should be written in the second-person.

@thosakwe
thosakwe / main.generated.js
Last active November 29, 2016 12:48
Generate curry functions
function add2(num) {
return num + 2;
}
function add2_array(num[]) {
return num.map(function(num) {
return add2(num);
});
}
@thosakwe
thosakwe / home.dart
Created December 28, 2016 05:23
Angel template hypothetical thing
import 'package:angel_framework/angel_framework.dart';
import 'package:angular2/angular2.dart';
import 'playing_card.dart';
import 'lib/models/user.dart';
@Component(
selector: 'home',
templateUrl: 'home.html',
directives: const [PlayingCardComponent])
class HomeComponent {
@thosakwe
thosakwe / user.js
Last active April 12, 2022 05:28
Press CTRL+SHIFT+Y/⌘+SHIFT+Y to click every 'Follow' button on the current Twitter page.
// ==UserScript==
// @name Auto-Follow Twitter Users
// @namespace https://gist.github.com/thosakwe/6f9fb4c3b7df5bac20c552781409dd41
// @version 1.0
// @description Press CTRL+SHIFT+Y/⌘+SHIFT+Y to click every 'Follow' button on the current Twitter page.
// @author thosakwe
// @match https://*.twitter.com/*
// @require https://code.jquery.com/jquery-3.1.1.slim.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.0/mousetrap.min.js
// @grant none