Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... into something like this: { "foo": "lorem", "bar": "ipsum" }
SQLをローカルでフォーマットするツールを探していてsqlparseというツールを見つけたので試してみました。 インストール sqlparseはPython製でpipを使ってインストールすることができます。 ウェブ上で使用する sqlparseはSQLFormatというオンラインサービスで使用されており、ブラウザやAPIでSQLを渡してフォーマットすることができます。 SQLFormat - Online SQL Formatter コマンドラインで使用する sqlparseをインストールすると使用可能になるsqlformatというコマンドに ファイルか標準入力でSQLを入力するとフォーマットされたSQLが出力されます。 -r で改行・インデント、-k upper でキーワードを大文字にすることができます。その他のオプションについては-h オプションで確認することができます。 $ SQL=
パブリックドメイン版 cflow には GNU cflow の -T, --tree * Draw ASCII art treeというオプションがないので、インデントで表された呼び出し構造(オフサイドルール?)をツリー形式に変換するコマンドを書いてみた。 #!/usr/bin/python import sys def getlevel(s): return len(s) - len(s.lstrip()) def parselist(lines): if len(lines) == 0: return [[], 0] tree = [] i = 0 currentlevel = getlevel(lines[0]) while i < len(lines): level = getlevel(lines[i]) if level > currentlevel: # Indent incr
パブリックドメイン版 cflow には GNU cflow の -T, --tree * Draw ASCII art treeというオプションがないので、インデントで表された呼び出し構造(オフサイドルール?)をツリー形式に変換するコマンドを書いてみた。 #!/usr/bin/python import sys def getlevel(s): return len(s) - len(s.lstrip()) def parselist(lines): if len(lines) == 0: return [[], 0] tree = [] i = 0 currentlevel = getlevel(lines[0]) while i < len(lines): level = getlevel(lines[i]) if level > currentlevel: # Indent incr
RDBMS でツリーを表すこんなデータを AA でツリー表示するスクリプトを書いてみた。 1 11 12 11 21 22 21 23 22 41 51 52 51 80 81 80 82 81 83 82 99999#!/usr/bin/env python # -*- coding: utf-8 -*- import sys class Node: def __init__(self, value="", parentkey=""): self.value = value self.parentkey = parentkey self.children = [] self.parent = None def show(self, level): if self.value != "": print " " * level + self.value for x in self.child
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く