Skip to content

Instantly share code, notes, and snippets.

Kris Selden krisselden

Block or report user

Report or block krisselden

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
View llogis.r
#!/usr/bin/env Rscript
# real load samples
a <- c(1075, 1043, 964, 965, 1067, 1111, 929, 1016, 983, 998, 995, 994, 995, 1064, 1025, 1078, 987, 998, 992, 1094, 965, 993, 1022, 964, 1002, 926, 1408, 1083, 944, 988, 960, 979, 939, 936, 990, 947, 1037, 1034, 1057, 1095, 1015, 941, 1054, 1050, 1192, 973, 1321, 1051, 974, 906)
b <- c(1023, 1175, 1230, 1055, 1073, 1118, 1030, 1093, 1095, 1040, 1166, 1257, 1151, 1047, 1217, 1247, 1256, 1057, 1152, 1074, 1016, 1040, 1176, 1135, 1003, 1178, 1136, 1402, 1215, 1176, 1107, 1202, 1080, 1068, 1133, 1091, 1041, 1143, 1140, 1156, 1062, 1076, 973, 1048, 1183, 1165, 1246, 1225, 1174, 1063)
# the 3 param log-logistic is a good distribution for simulating typical
# performance samples from page load
dllogis <- function(x, location = 0, scale = 1, shape = 2) {
((shape / scale) * (((x - location) / scale)^(shape - 1))) / (
View better-glimmer-debugging.md

Pass in an invocables array of c => c() that is source mapped to mustache/Component/s-exp locations during template compile.

Now anytime the VM executes something that invokes user land code that might fail it can do it with the slotted invocable wrapper in both Append mode or Update mode and with the sourcemap this will place the hbs file on the stack and allow you to set a breakpoint in the mustache, Component or subexpression.

Also, possibly make bindings thunks so they can be debugged when the VM reads them, so if they were an unexpected value you'd be able to see.

View request_streaming_samples.r
library(tidyverse)
# sample, treatment, chunk size, timestamp
chunks <- read.csv("results.csv")
sorted_and_summed <- chunks %>%
group_by(sample) %>%
arrange(timestamp, .by_group = T) %>%
mutate(
bytes_received = cumsum(bytes),
View test_stream.js
const tls = require("tls");
const https = require("https");
const { pipeline, Writable } = require("stream");
const zlib = require("zlib");
const { StringDecoder } = require("string_decoder");
/**
* @typedef {Object} Config
* @property {string} url
* @property {string} sessionCookie
View test_async_context.js
import async_hooks from 'async_hooks';
import fs from 'fs';
function createSyncOut() {
let indent = 2;
return [
function putln(msg) {
const indentStr = ' '.repeat(Math.max(0, indent));
fs.writeSync(1, `${indentStr}${msg}\n`);
},
@krisselden
krisselden / main.rs
Last active Feb 29, 2020
flatten json RawValue
View main.rs
use serde::de::{Deserialize, Deserializer, MapAccess, Visitor};
use serde_json::value::RawValue;
use std::collections::HashMap;
use std::fmt;
use std::marker::PhantomData;
#[derive(Debug)]
struct TestA<'a> {
a: i32,
rest: HashMap<&'a str, &'a RawValue>,
View hang_heartbeat.js
const http = require("http");
const vm = require("vm");
const fs = require("fs");
function scheduleLoop(schedule) {
function loop(sum = 0) {
schedule(() => loop(doSomeWork(sum)));
}
schedule(loop);
}
View debugPrint.js
/**
* Print object if running with --js-flag="--allow-natives-syntax"
*/
const __debugPrint = (() => {
try {
return new Function("x", "%DebugPrint(x)");
} catch (e) {
return () => void 0;
}
})();
View trace-code.sh
#!/usr/bin/env bash
# check for CHROME_PATH env or just default
cmd=${CHROME_PATH:-$HOME/chromium/src/out/Default/Chromium.app/Contents/MacOS/Chromium}
if [ -z "$1" ]
then
echo "Usage: `basename $0` [url]"
exit 1
fi
View InnerStackProto.diff
< DebugPrint: 0x4738baeff9: [JS_OBJECT_TYPE] in OldSpace
---
> DebugPrint: 0x47a334ac31: [JS_OBJECT_TYPE] in OldSpace
7,15c7,15
< #slice: 0x00479ca7bfc1 <JSFunction n.slice (sfi = 0x47a98760d9)> (const data field 1)
< #sliceInner: 0x00479ca7c001 <JSFunction n.sliceInner (sfi = 0x47a9876131)> (const data field 2)
< #copy: 0x00479ca7c041 <JSFunction n.copy (sfi = 0x47a9876189)> (const data field 3)
< #write: 0x00479ca7c081 <JSFunction n.write (sfi = 0x47a98761e1)> (const data field 4) properties[0]
< #writeJs: 0x00479ca7c0f1 <JSFunction n.writeJs (sfi = 0x47a9876241)> (const data field 5) properties[1]
< #writeRaw: 0x00479ca7c131 <JSFunction n.writeRaw (sfi = 0x47a9876299)> (const data field 6) properties[2]
You can’t perform that action at this time.