Skip to content

Instantly share code, notes, and snippets.

Ian McKellar ianloic

View GitHub Profile
View 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 / crashypants.cc
Last active Jan 3, 2019
Why is this wrong?
View crashypants.cc
#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;
@ianloic
ianloic / hello-rdl.rb
Created Sep 24, 2018
Various hellos world.
View hello-rdl.rb
require 'rdl'
require 'types/core'
extend RDL::Annotate
type '(String) -> nil', typecheck: :now
def greet(name)
puts "hello, #{name}."
end
View main.dart
import 'dart:async';
class AsyncProxyController<T> {
}
class AsyncProxy<T> {
AsyncProxyController<T> ctrl;
}
View events.dart
// 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';
View main.dart
import 'dart:async';
import 'other.dart' show Error;
abstract class Wlan {
Future<Error> method();
}
class WlanFuturize {
final Wlan _inner;
@ianloic
ianloic / NUCReset.ino
Created Nov 13, 2017
Adafruit Feather Sketch for sending a reset signal to an Intel NUC using a Non-Latching Relay Featherwing with signal on A2
View NUCReset.ino
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.");
@ianloic
ianloic / make-test-files.sh
Last active May 19, 2017
Comparing scp and netcp, nuc ethernet and USB ethernet
View make-test-files.sh
#!/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
View gist:38b267c05d49b6a71a80f65b75b089d1
% ssh -o RequestTTY=no fuchsia@192.168.3.53 hello world
______________
| hello world |
--------------
\ ^__^
\ (oo)\_____
(__)\ )\/\
||----w |
|| ||
View wrappers.cc
#include <utility>
#include <iostream>
#include <atomic>
#include <set>
class OnceWatcher {
public:
virtual void Called() = 0;
};
You can’t perform that action at this time.