Skip to content

Instantly share code, notes, and snippets.

View kawaz's full-sized avatar
🏠
Working from home

Yoshiaki Kawazu kawaz

🏠
Working from home
View GitHub Profile
@purcell
purcell / access-log-to-parquet.sql
Created September 4, 2023 19:23
Use DuckDB to convert a compressed web access log in Combined Log Format to Parquet
COPY (
WITH
-- Read the raw log line by line by abusing CSV parser
raw_log AS (
FROM read_csv_auto('/tmp/log/access.log-20230904.gz', header=false, delim='\0')
)
, combined_log AS (
SELECT regexp_extract(column0
, '^(\S+) (\S+) (\S+) \[(.*?)\] "([A-Z]+?) (.*?) HTTP/(.*?)" (\d+) (\d+) "(.*?)" "(.*?)"$'
, [ 'ip', 'identity', 'userid', 'timestamp', 'method'
@kawaz
kawaz / select-finder-items.swift
Created February 8, 2023 06:47
Finderでファイルを選択状態にするスクリプト。複数も可。
#!/usr/bin/swift
import AppKit
let urls = CommandLine.arguments.dropFirst(1).map { URL(fileURLWithPath: $0) }
NSWorkspace.shared.activateFileViewerSelecting(urls)
@voluntas
voluntas / zig_quic.md
Last active August 28, 2024 19:09
2022 年の夏休みに Zig で QUIC を実装してオープンソースとして公開するお手伝い

2022 年の夏休みに Zig で QUIC を実装してオープンソースとして公開するお手伝い

こちらの応募は終了しました、冬も募集予定です。

成果

@samthor
samthor / eventlistener-signal-support.js
Last active June 22, 2024 18:10
Polyfill/code for the signal argument to addEventListener
// This is part of the blog post here: https://whistlr.info/2022/abortcontroller-is-your-friend/
// ...and can be used to detect/polyfill the `signal` argument to addEventListener.
//
// Note that at writing, 86%+ of active browsers already support it:
// https://caniuse.com/mdn-api_eventtarget_addeventlistener_options_parameter_options_signal_parameter
// ...but that 92% of browsers support `AbortController` and signal.
//
// So there's 6% of total browsers which will fail silently when adding the `signal` argument.
// Eyeballing it, this is mostly Safari 11-15 and Chrome 66-90. These snippets can help with those targets.
//
@mugi-uno
mugi-uno / remote-work-style-check.md
Last active October 10, 2022 11:26
リモートワークスタイルチェック

リモートワークスタイルチェック

昨今の社会情勢の影響もありリモートワークを導入する企業・チームが増えてきましたが、 一口に「リモートワーク」といってもさまざまなスタイルがあります。

企業側と働く側のミスマッチを防ぐため、リモートワークにおける観点を列挙してみました。

リモートワーク比重度

どの程度リモートワークに比重を置いて導入しているかのチェックリストです。

@kawaz
kawaz / setup-autoreboot-on-oom-killer.sh
Last active January 21, 2020 22:03
OOM-Killer が発動したら自動でリブートさせるやつを設定するやつ(コピペ実行で摘要できます)
#!/bin/bash
(
echo '# OOM-Killer が発動したら自動でリブートさせるやつを設定するやつ'
echo '# https://gist.github.com/kawaz/1605bec92acac16d0638591e4bbfd5b1'
echo vm.overcommit_memory = 1
echo vm.panic_on_oom = 1
echo kernel.panic = 1
) > /etc/sysctl.d/99-custom-autoreboot-on-oom-killer
sysctl -p /etc/sysctl.d/99-custom-autoreboot-on-oom-killer
# SWAP止めちゃう
@dreampuf
dreampuf / main.go
Last active December 28, 2023 06:46
Golang SSHAgent Usage Example
package main
/*
Golang SSHAgent Usage
https://orebibou.com/2019/03/golang%E3%81%A7ssh-agent%E3%81%8B%E3%82%89%E9%8D%B5%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6ssh%E6%8E%A5%E7%B6%9A%E3%81%99%E3%82%8B/
*/
import (
"fmt"
"golang.org/x/crypto/ssh"
@sandren
sandren / tailwind.md
Last active October 12, 2024 17:10
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@mono0926
mono0926 / commit_message_example.md
Last active November 12, 2024 05:33
[転載] gitにおけるコミットログ/メッセージ例文集100
@kawaz
kawaz / USAGE.md
Last active March 7, 2016 18:52
shutdown -r nowをする前後に実行してipやmount状況やlisten状況の差分が無いかざっと確認する。

再起動の前後に以下を実行する感じで使う。

curl -sL https://gist.githubusercontent.com/kawaz/eed1c5582ccf975753c6/raw/dump_and_diff.sh | bash

ダンプを保存する場所を変えたければ以下のようにすれば良い

curl -sL https://gist.githubusercontent.com/kawaz/eed1c5582ccf975753c6/raw/dump_and_diff.sh | bash /dev/stdin /tmp/hogehoge