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 / main.rs
Last active March 8, 2024 10:50
Rust: reading lines from STDIN and printing them back to console
use std::io;
fn main() {
// Iterate over the lines in io::stdin()
for line in io::stdin().lines() {
// Now print the line (line.unwrap() first) via the println!() macro
println!("{}", line.unwrap());
}
}
@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 / gist:3ff908eaf695f834fb60
Last active March 26, 2016 05:24
Every single *File that exists in these different language/libraries...
Podfile
Capfile
Gemfile
Gomfile
Makefile
Thorfile
Cakefile
Caskfile
Jakefile
Doxyfile
@brendanashworth
brendanashworth / gist:8534725
Last active January 3, 2016 23:19
Star out the last number set of an IP.
<?php
$ip = "10.0.11.145";
$array = explode(".", $ip);
$numbers = $array[0] . "." . $array[1] . "." . $array[2];
$numbers .= ".";
for($i = 0; $i < strlen($array[3]); $i++) {
@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);