Skip to content

Instantly share code, notes, and snippets.

View natanbc's full-sized avatar
💭
git push --force

Natan natanbc

💭
git push --force
View GitHub Profile

Keybase proof

I hereby claim:

  • I am natanbc on github.
  • I am natan (https://keybase.io/natan) on keybase.
  • I have a public key ASCERNtQF2DJHWK5GFunDaKhmwnpt16SlTeep1sJK7eKjwo

To claim this, I am signing this object:

embed {
author = {
name = format("%username%#%discriminator%"),
icon = format("%avatar%"),
url = nil
},
timestamp = "creation",--can also be "now"
footer = {
text = format("Message sent on #%channel_name%"),
icon = nil
package gabrielbot.module
import java.io.{ByteArrayOutputStream, InputStream}
import java.net.URLClassLoader
import java.util
import java.util.jar.JarFile
import com.github.natanbc.optional.{Optional, OptionalInterface}
import org.objectweb.asm.{AnnotationVisitor, ClassReader, ClassVisitor, ClassWriter, FieldVisitor, MethodVisitor, Opcodes}
@natanbc
natanbc / Main.java
Last active December 4, 2017 12:04
DBL lib indexing
public class Main {
public static void main(String[] args) throws Throwable {
DiscordBotsAPI api = new DiscordBotsAPI();
Map<String, Integer> map = api.index().stream().map(BotInfo::getLib).collect(Collectors.groupingBy(
Function.identity(),
Collectors.collectingAndThen(Collectors.counting(), Long::intValue)
));
int total = map.values().stream().mapToInt(Integer::intValue).sum();
import com.mewna.catnip.Catnip;
import com.mewna.catnip.shard.DiscordEvent;
import io.vertx.core.json.DecodeException;
import io.vertx.core.json.JsonObject;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
@natanbc
natanbc / adventofcode.ex
Created December 1, 2018 19:38
Advent of Code runner. Reads input and calls each day, running all days asynchronously and printing outputs in order
defmodule Adventofcode do
@days 1
def main(_) do
Enum.flat_map(1..@days, &run/1)
|> wait_for()
end
def run_day(day), do: run(day) |> wait_for()
const defaultv = Symbol("default");
const extractor = Symbol("extractor");
const extract = function(as, opts) {
if(typeof as === "object") {
opts = as;
as = null;
}
const f = function(name, value, dest) {
if(opts && opts.validator) {
if(!opts.validator(value, name)) {
@natanbc
natanbc / docs.md
Last active April 8, 2019 23:01
run.codes test runner

Test Runner

Installation

Copy the test-runner.sh file somewhere and set it as executable (chmod +x test-runner.sh)

Usage

Run ./test-runner.sh .

const fs = require("fs");
const cp = require("child_process");
function equals(a, b) {
const compare = toUTF8(b).map(c => `
call readch
cmp byte ptr [r8], ${c}
jne fail
`);
const code = `.intel_syntax noprefix