Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lufia's full-sized avatar

KADOTA, Kyohei lufia

View GitHub Profile
@lufia
lufia / Dockerfile
Created March 2, 2022 04:51
Dockerfile builds an image running bash that is enabled git-subrepo
#
# usage: docker run -ti --rm -v $(pwd):/docs -v ~/.ssh:/root/.ssh:ro xx
#
FROM debian:11
RUN apt-get update && \
apt-get install -y git make golang && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /app /docs && \
git clone https://github.com/ingydotnet/git-subrepo.git /app/git-subrepo && \
@lufia
lufia / fs_darwin.c
Last active December 11, 2020 06:36
dfが何を使って出力しているのか調べたコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/mount.h>
// /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h
@lufia
lufia / inittest.c
Created August 8, 2020 12:31
C言語の自動変数で構造体の初期化を検証するコード
#include <u.h>
#include <libc.h>
typedef struct Time Time;
typedef union Metric Metric;
typedef struct Value Value;
struct Time {
vlong sec;
};
@lufia
lufia / plan9-git.md
Last active June 4, 2020 09:15
Plan 9でgit

(作業中メモ)

準備

c=/mnt/term/Users/lufia/src/github.com/0intro/plan9-contrib
bind -a $c/sys/lib/tls /sys/lib/tls
bind /tmp/x/ape /sys/include/ape
bind /tmp/x/arch /386/include/ape/
bind $home/bin/386/cpp /bin/cpp
@lufia
lufia / go-scan.sh
Last active February 7, 2020 06:02
参照パッケージを列挙するコマンド
#!/bin/sh
set -eu
list_pkgs()
{
local f
f=$(cat <<-'END'
{{range .Imports}}{{.}}
@lufia
lufia / ciphersuite.go
Last active June 3, 2019 07:22
ホスト直接指定してTLS暗号スイートを確認する方法
package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"
"os"
)
@lufia
lufia / unesc.c
Created March 5, 2019 09:17
removes escape sequences
#include <u.h>
#include <libc.h>
#include <bio.h>
static void
usage(void)
{
fprint(2, "usage: %s [file ...]\n", argv0);
exits("usage");
}
@lufia
lufia / cert-plan9.go
Last active August 21, 2018 13:34
Retrieve a certificate
package main
import (
"context"
"crypto/tls"
"flag"
"io"
"log"
"net/http"
"net/url"
@lufia
lufia / clw.bash
Last active February 5, 2018 04:32
clear window content of acme
#!/usr/bin/env bash
# ref https://groups.google.com/forum/#!topic/comp.os.plan9/dL9RQnlY6So
w=acme/$winid
echo -n Edit ,d | 9p write $w/body
echo -n /Edit ,d/ | 9p write $w/addr
echo -n 'dot=addr' | 9p write $w/ctl
9p read $w/addr | awk '{printf("MX%s %s\n", $1, $2)}' | 9p write $w/event
@lufia
lufia / goinstall.bash
Created December 20, 2017 08:42
Install go-gettable packages with temporary GOPATH
#!/usr/bin/env bash
# usage: goinstall [pkg ...]
if [[ -z $GOPATH ]]
then
echo $(basename $0): requires GOPATH >&2
exit 1
fi
IFS=: paths=($GOPATH)