Skip to content

Instantly share code, notes, and snippets.

View brendanashworth's full-sized avatar
🐦
bunting

Brendan Ashworth brendanashworth

🐦
bunting
View GitHub Profile
@brendanashworth
brendanashworth / kilimanjaro_routes.geojson
Created December 9, 2022 21:13
Routes up Mt Kilimanjaro
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brendanashworth
brendanashworth / starbucks_in_seattle.geojson
Created November 30, 2022 07:03
Starbucks near Seattle
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brendanashworth
brendanashworth / boroughs.geojson
Created September 26, 2022 23:05
example data sources for mundi.py quickstart: https://docs.mundi.ai/quickstart
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
commit 16ab1b6b97313fcfc43110d5ba9f1fd37d5b3939
Author: Brendan Ashworth <brendan.ashworth@me.com>
Date: Sat Dec 4 15:46:43 2021 -0500
add getsockopt for last packet size
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 48d8a3633..1bbb1398e 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@brendanashworth
brendanashworth / example.js
Created August 5, 2016 05:33
minio with wkhtmltopdf
const Minio = require('minio')
var client = new Minio({ ... })
// Create the stream.
let stream = wkhtmltopdf('http://google.com/', { pageSize: 'letter' })
// Upload it into minio.
client.putObject('bucket', 'google-page', stream, /* size of pdf */, (err, etag) => {
if (err) throw err
@brendanashworth
brendanashworth / bench.js
Last active October 8, 2015 03:26
es6 arrow functions vs regular functions
'use strict';
var callarrow = () => { return 1 };
var arrow = () => {
var j = 0;
for (var i = 0; i < 100; i++) {
j += callarrow();
}
// Simple one-function benchmark for node.js
// originally from http://mrale.ph/blog/2011/03/30/external-arrays-and-nodejs.html
// Pass n = number of iterations (only affects accuracy of ns/op)
// Pass f = function to call
function benchmark(n, f) {
var start = process.hrtime();
for (var i = 0; i < n; i++) f();
var end = process.hrtime(start);
@brendanashworth
brendanashworth / test.js
Created June 23, 2015 21:54
http parser test
'use strict';
// switch them around to see difference in results
//const HTTPParser = process.binding('http_parser').HTTPParser;
const HTTPParser = require('_http_parser');
var parser = new HTTPParser(HTTPParser.RESPONSE);
var buf;
if (1) {
@brendanashworth
brendanashworth / binding.cc
Created June 5, 2015 00:34
node::AtExit callback test
#include <node.h>
#include <stdio.h>
using namespace v8;
void Exit(void* arg) {
printf("node::AtExit called\n");
}
void Initialize(Handle<Object> exports) {
// Licensed io.js code
posix.relative = function(from, to) {
assertPath(from);
assertPath(to);
from = posix.resolve(from).substr(1);
to = posix.resolve(to).substr(1);
function trim(arr) {
var start = 0;