Skip to content

Instantly share code, notes, and snippets.

View ianloic's full-sized avatar

Ian McKellar ianloic

View GitHub Profile
@ianloic
ianloic / make-test-files.sh
Last active May 19, 2017 04:21
Comparing scp and netcp, nuc ethernet and USB ethernet
#!/bin/bash
set -eu
# gzip a user.bootfs to make a high-entropy test files
# make 10M, 1M, 100K, 10K test files
gzip -c < $FUCHSIA_BUILD_DIR/user.bootfs | dd of=test-file-10M bs=1M count=10 iflag=fullblock
dd if=test-file-10M of=test-file-1M bs=1M count=1
dd if=test-file-10M of=test-file-100K bs=10K count=10
dd if=test-file-10M of=test-file-10K bs=10K count=1
@ianloic
ianloic / NUCReset.ino
Created November 13, 2017 18:50
Adafruit Feather Sketch for sending a reset signal to an Intel NUC using a Non-Latching Relay Featherwing with signal on A2
int SIGNAL = A2;
void setup() {
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("hello.");
import 'dart:async';
import 'other.dart' show Error;
abstract class Wlan {
Future<Error> method();
}
class WlanFuturize {
final Wlan _inner;
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WARNING: This file is machine generated by fidlgen.
library fidl_fidl_examples_events$async;
import 'dart:async';
import 'dart:typed_data';
import 'dart:async';
class AsyncProxyController<T> {
}
class AsyncProxy<T> {
AsyncProxyController<T> ctrl;
}
@ianloic
ianloic / hello-rdl.rb
Created September 24, 2018 17:21
Various hellos world.
require 'rdl'
require 'types/core'
extend RDL::Annotate
type '(String) -> nil', typecheck: :now
def greet(name)
puts "hello, #{name}."
end
@ianloic
ianloic / error.html
Created February 26, 2019 17:35
error.html
<html>
<head>
<title>No Tunnel</title>
</head>
<body>
<h1>No Tunnel</h1>
<p>There is no tunnel configured for <i><script>document.write(location.host)</script></i>...</p>
<p>Create a tunnel with:
<code>
@ianloic
ianloic / Makefile
Created September 7, 2019 03:47
fontconfig is easy
CFLAGS=$(shell pkg-config --cflags fontconfig)
LDFLAGS=$(shell pkg-config --libs fontconfig)
example: example.o
@ianloic
ianloic / crashypants.cc
Last active March 3, 2020 07:57
Why is this wrong?
#include <iostream>
#include <string>
#include <vector>
void test_string_vector() {
std::vector<std::string> v;
const char* one = v.emplace_back("one").data();
std::cout << "added one" << std::endl;
std::cout << "v.capacity() = " << v.capacity() << std::endl;
import typing, math
from nmigen import *
from nmigen.build import Platform
from nmigen.back.pysim import Simulator, Delay
class Pulse(Elaboratable):
def __init__(self,
frequency: float,
clock_frequency: typing.Optional[float],