Skip to content

Instantly share code, notes, and snippets.

View wperron's full-sized avatar
🚀
Launching into orbit

William Perron wperron

🚀
Launching into orbit
View GitHub Profile
@wperron
wperron / test-output.txt
Created September 23, 2020 17:29
my test results for deno
$ cargo test --release > test-output.txt
Compiling libc v0.2.77
Compiling proc-macro2 v1.0.21
Compiling unicode-xid v0.2.1
Compiling cfg-if v0.1.10
Compiling syn v1.0.41
Compiling autocfg v1.0.1
Compiling memchr v2.3.3
Compiling lazy_static v1.4.0
Compiling log v0.4.11
@wperron
wperron / cat.ts
Last active September 23, 2020 18:17
Deno cat
// yes, it's that simple.
Deno.copy(Deno.stdin, Deno.stdout);
@wperron
wperron / dbmigrate.ts
Last active October 15, 2020 01:04
migrating deno registry modules to include the repository ID
import { assert } from "https://deno.land/std@0.73.0/testing/asserts.ts";
import { pooledMap } from "https://deno.land/std@0.73.0/async/pool.ts";
import { Database } from "../utils/database.ts";
const db = new Database(Deno.env.get("MONGO_URI") ?? "");
const GH_TOKEN = Deno.env.get("GH_TOKEN");
assert(GH_TOKEN);
const all = await db._modules.find({});
@wperron
wperron / large_diff.ts
Created October 21, 2020 12:35
demo test output on long strings nested in objects in deno
import { assertEquals } from "https://deno.land/std@0.74.0/testing/asserts.ts";
Deno.test("test", async () => {
assertEquals(
{
foo: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of ERROR ERROR."
},
{
foo: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five
@wperron
wperron / index_test.js
Created November 20, 2020 13:30
palindrome check benchmarks
import { assert } from "https://deno.land/std@0.78.0/testing/asserts.ts";
import {
bench,
runBenchmarks,
} from "https://deno.land/std@0.78.0/testing/bench.ts";
function isPalindromeSimple(s) {
return s === s.split("").reverse().join("");
}
@wperron
wperron / main.go
Created November 22, 2020 17:46
Golang Reverse LinkedList
package main
import (
"fmt"
)
type Node struct {
Val interface{}
Next *Node
}
@wperron
wperron / debug.txt
Created December 24, 2020 19:43
Terraform Debug Output - Lambda 409s
$ TF_LOG=DEBUG terraform apply -parallelism=1 plan.tfplan
2020/12/24 14:33:52 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2020/12/24 14:33:52 [INFO] Terraform version: 0.14.3
2020/12/24 14:33:52 [INFO] Go runtime version: go1.15.2
2020/12/24 14:33:52 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply", "-parallelism=1", "plan.tfplan"}
2020/12/24 14:33:52 [DEBUG] Attempting to open CLI config file: /home/wperron/.terraformrc
2020/12/24 14:33:52 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/12/24 14:33:52 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
@wperron
wperron / pooledmap_uncaught.ts
Created January 9, 2021 01:47
Example of exception thrown in pooledMap not getting caught
import { pooledMap } from "https://deno.land/std@0.83.0/async/pool.ts";
async function collectAsyncIterable<T>(
iterator: AsyncIterable<T>,
): Promise<T[]> {
const collected = [] as T[];
for await (const v of iterator) {
collected.push(v);
}
return collected;
@wperron
wperron / cmd-namespaced.go
Created January 26, 2021 14:29
Add a namespace prefix to the output of a subprocess
package main
import (
"bufio"
"fmt"
"io"
"log"
"os/exec"
)
@wperron
wperron / main.ts
Created February 7, 2021 21:05
Deno Security Vulnerabilities Proof-of-Concept
import { greet } from "https://deno.wperron.io/evil-module@1.0.0/mod.ts";
console.log(greet("John Doe"));