Skip to content

Instantly share code, notes, and snippets.

Avatar

KADOTA, Kyohei lufia

View GitHub Profile
@lufia
lufia / fs_darwin.c
Last active Dec 11, 2020
dfが何を使って出力しているのか調べたコード
View fs_darwin.c
#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 Aug 8, 2020
C言語の自動変数で構造体の初期化を検証するコード
View inittest.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 / go-scan.sh
Last active Feb 7, 2020
参照パッケージを列挙するコマンド
View go-scan.sh
#!/bin/sh
set -eu
list_pkgs()
{
local f
f=$(cat <<-'END'
{{range .Imports}}{{.}}
@lufia
lufia / ciphersuite.go
Last active Jun 3, 2019
ホスト直接指定してTLS暗号スイートを確認する方法
View ciphersuite.go
package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"
"os"
)
@lufia
lufia / unesc.c
Created Mar 5, 2019
removes escape sequences
View unesc.c
#include <u.h>
#include <libc.h>
#include <bio.h>
static void
usage(void)
{
fprint(2, "usage: %s [file ...]\n", argv0);
exits("usage");
}
@lufia
lufia / plan9-git.md
Last active Jun 4, 2020
Plan 9でgit
View plan9-git.md

(作業中メモ)

準備

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 / cert-plan9.go
Last active Aug 21, 2018
Retrieve a certificate
View cert-plan9.go
package main
import (
"context"
"crypto/tls"
"flag"
"io"
"log"
"net/http"
"net/url"
@lufia
lufia / clw.bash
Last active Feb 5, 2018
clear window content of acme
View clw.bash
#!/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 Dec 20, 2017
Install go-gettable packages with temporary GOPATH
View goinstall.bash
#!/usr/bin/env bash
# usage: goinstall [pkg ...]
if [[ -z $GOPATH ]]
then
echo $(basename $0): requires GOPATH >&2
exit 1
fi
IFS=: paths=($GOPATH)
@lufia
lufia / fields.bash
Created Dec 7, 2017
convert empty line separated key value pair files to table
View fields.bash
#!/usr/bin/env bash
flagh=0
case $1 in
-h) flagh=1
shift
;;
-*) echo usage: $(basename $0) [-h] [file ...] >&2
exit 1