Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
hackin'

Benjamin E. Coe bcoe

💭
hackin'
View GitHub Profile
@bcoe
bcoe / npm-top.md
Last active March 22, 2023 14:51
npm-top.md
View npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads
@bcoe
bcoe / changelog.proto
Created January 18, 2023 18:38
changelog.proto
View changelog.proto
syntax = "proto3";
import "google/protobuf/timestamp.proto";
message ChangeLog {
// Repository in form org/repo.
string repository = 1;
// When was an entry last added to changelog.json.
google.protobuf.Timestamp update_time = 5;
// Each CHANGELOG entry corresponds to a release on GitHub.
@bcoe
bcoe / cli.mjs
Created May 25, 2022 14:49
cli.mjs
View cli.mjs
import {parseArgs} from 'node:util';
class ArgumentsMissingError extends Error {
constructor(values) {
let msg;
if (!values.variable1 && !values.variable2) {
msg = 'both variable1 and variable2 must be provided';
} else {
msg = `${!values.variable1 ? 'variable1' : 'variable2'} must be provided`;
}
@bcoe
bcoe / json.lua
Created April 18, 2014 07:25
Atomic update of JSON in Redis
View json.lua
# atomic update of a key using LUA.
EVAL "local t1 = cjson.decode(redis.call('get', ARGV[1])); local t2 = cjson.decode(ARGV[2]); for k,v in pairs(t2) do t1[k] = v end; redis.call('set', ARGV[1], cjson.encode(t1))" 0 "foo" '{"bar": 3}'
local id = ARGV[1]
local t1 = cjson.decode(redis.call('get', id)
local t2 = cjson.decode(ARGV[2])
# merge the new hash with the prior hash.
for k,v in pairs(t2) do t1[k] = v end
redis.call('set', id, cjson.encode(t1))
@bcoe
bcoe / updating-svg.yaml
Created June 22, 2021 13:43
updating-svg.yaml
View updating-svg.yaml
on:
push:
branches:
- main
name: push-interest-changes
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@bcoe
bcoe / SourceMap.js
Created September 29, 2019 20:42
SourceMap.js
View SourceMap.js
// This file is a modified version of:
// https://cs.chromium.org/chromium/src/v8/tools/SourceMap.js?rcl=dd10454c1d
// from the V8 codebase. Logic specific to WebInspector is removed and linting
// is made to match the Node.js style guide.
// Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
View comet-server.py
import thread, time
import socket
from hackwars.orbited_server.comet import handle_request
from orbited import start
def listen():
try:
comet_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
comet_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@bcoe
bcoe / xunit.xml
Created May 30, 2020 00:45
xunit.xml
View xunit.xml
<testsuite name="Mocha Tests" tests="640" failures="0" errors="2" skipped="0" timestamp="Sat, 30 May 2020 00:28:04 GMT" time="7.529">
<testcase classname="" name="should expose yargs-parser as Parser" time="0"/>
<testcase classname="Argsert" name="does not warn if optional argument is not provided" time="0.002"/>
<testcase classname="Argsert" name="warn if wrong type is provided for optional argument" time="0.002"/>
<testcase classname="Argsert" name="does not warn if optional argument is valid" time="0.001"/>
<testcase classname="Argsert" name="warns if required argument is not provided" time="0.002"/>
<testcase classname="Argsert" name="warns if required argument is of wrong type" time="0.001"/>
<testcase classname="Argsert" name="supports a combination of required and optional arguments" time="0.001"/>
<testcase classname="Argsert" name="warns if too many arguments are provided" time="0.001"/>
<testcase classname="Argsert" name="warn with argument position if wrong type is provided for argument" time="0.00
@bcoe
bcoe / xunit.xml
Last active May 30, 2020 00:45
xunit.xml
View xunit.xml
<testsuite name="Mocha Tests" tests="640" failures="0" errors="2" skipped="0" timestamp="Sat, 30 May 2020 00:28:04 GMT" time="7.529">
<testcase classname="" name="should expose yargs-parser as Parser" time="0"/>
<testcase classname="Argsert" name="does not warn if optional argument is not provided" time="0.002"/>
<testcase classname="Argsert" name="warn if wrong type is provided for optional argument" time="0.002"/>
<testcase classname="Argsert" name="does not warn if optional argument is valid" time="0.001"/>
<testcase classname="Argsert" name="warns if required argument is not provided" time="0.002"/>
<testcase classname="Argsert" name="warns if required argument is of wrong type" time="0.001"/>
<testcase classname="Argsert" name="supports a combination of required and optional arguments" time="0.001"/>
<testcase classname="Argsert" name="warns if too many arguments are provided" time="0.001"/>
<testcase classname="Argsert" name="warn with argument position if wrong type is provided for argument" time="0.00
@bcoe
bcoe / test-output.tap
Created May 29, 2020 23:32
test-output.tap
View test-output.tap
TAP version 13
1..169
ok 1 parallel/test-fs-access
---
duration_ms: 0.87
...
ok 2 parallel/test-fs-append-file
---
duration_ms: 0.86
...