Skip to content

Instantly share code, notes, and snippets.

View ianloic's full-sized avatar

Ian McKellar ianloic

View GitHub Profile
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <depfile> <command...>" >&2
exit 1
fi
# The .d file we're going to write.
DEPSFILE=$1
shift
@ianloic
ianloic / remote-code.zsh
Created February 16, 2021 19:49
Zsh function to invoke vscode remote
code () {
local script=$(echo ~/.vscode-server/bin/*/bin/code(*ocNY1))
if [[ -z ${script} ]]
then
echo "VSCode remote script not found"
exit 1
fi
local socket=$(echo /run/user/$UID/vscode-ipc-*.sock(=ocNY1))
if [[ -z ${socket} ]]
then
type piece interface {
Write(wr io.Writer)
}
type stringPiece string
func (sp stringPiece) Write(wr io.Writer) {
fmt.Fprint(wr, string(sp))
}
@ianloic
ianloic / README
Last active December 18, 2020 18:59
uring statx failure
Stating a bunch of files in a git repo fails in a weird way.
It doesn't fail every time but in my checkout of https://github.com/git/git it fails about 30% of the time.
I invoke:
git ls-files | strace -o /tmp/stat-many.strace ~/Projects/git-dirty/stat-many $PWD
I have attached a failing strace.
I'm running a 5.7.17 kernel on amd64 with liburing 0.7 from Debian.
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],
@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;
@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 / 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 / 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