Awk

Awkコードスクリーンショット生成

Awkのスニペットを、Macから離れることなく共有したくなる画像に。

Awk one-liners are shared constantly and almost always as text, where the quoting gets mangled on the way.

Codeshotは貼り付けたコードからAwkを判別するので、言語の選び間違いは起きません。付属する30種類のうち3つのテーマで同じスニペットを、アプリ自身のスタイルシートで表示しています。

#!/usr/bin/awk -f
BEGIN { FS = ","; printf("%-12s %s
", "THEME", "COUNT") }

{ counts[$1]++ }

END {
    for (theme in counts)
        printf("%-12s %d
", theme, counts[theme])
}
GitHub · ダーク
#!/usr/bin/awk -f
BEGIN { FS = ","; printf("%-12s %s
", "THEME", "COUNT") }

{ counts[$1]++ }

END {
    for (theme in counts)
        printf("%-12s %d
", theme, counts[theme])
}
Solarized · ダーク
#!/usr/bin/awk -f
BEGIN { FS = ","; printf("%-12s %s
", "THEME", "COUNT") }

{ counts[$1]++ }

END {
    for (theme in counts)
        printf("%-12s %d
", theme, counts[theme])
}
Tokyo Night · ダーク

Awkに合うテーマ選び

If the snippet is a one-liner, put the plain text in the post as well. An awk program people have to retype from a picture will be retyped wrong.

サイズを正しく決める

画像サイズを内容に合わせるか、比率で固定します(1:1、4:3、3:2、16:9、9:16、2:3、3:4)。そのうえで1×・2×・3×から選んで書き出せば、Retinaディスプレイでも鮮明なままです。Cでクリップボードに直接コピー、またはSで保存できます。

30種類のテーマを見比べるか、全体の流れをご覧ください。

Awkと、ほかの59言語のために

すべてMac上で動作します。コードが外に出ることはありません。

macOS版をダウンロード