home / system

Menu
  • GraphQL API
  • Search all tables

tools_source

Table actions
  • GraphQL API for tools_source

Data license: All Rights Reserved · Data source: krisyotam.com · About: Kris Yotam

2 rows where tool_id = 3

✎ View and edit SQL

This data as json, CSV (advanced)

id ▼ tool_id filename language content
15 epoch 3 epoch.py py #!/usr/bin/env python3 """epoch — convert between unix timestamps and dates""" import sys from datetime import datetime, timezone def main(): inp = sys.argv[1] if len(sys.argv) > 1 else input().strip() try: ts = int(inp) dt = datetime.fromtimestamp(ts, tz=timezone.utc) print(dt.isoformat()) except ValueError: dt = datetime.fromisoformat(inp) print(int(dt.timestamp())) if __name__ == "__main__": main()
16 epoch 3 epoch.sh sh #!/bin/sh # epoch — convert between unix timestamps and dates if [ -z "$1" ]; then read -r input else input="$1" fi case "$input" in *[!0-9]*) # input is a date string, convert to epoch date -d "$input" +%s 2>/dev/null || date -j -f "%Y-%m-%d %H:%M:%S" "$input" +%s ;; *) # input is epoch, convert to date date -d "@$input" --iso-8601=seconds 2>/dev/null || date -r "$input" +%Y-%m-%dT%H:%M:%S%z ;; esac

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE tools_source (id INTEGER PRIMARY KEY AUTOINCREMENT, tool_id INTEGER NOT NULL, filename TEXT NOT NULL, language TEXT NOT NULL, content TEXT NOT NULL, FOREIGN KEY (tool_id) REFERENCES tools(id) ON DELETE CASCADE, UNIQUE(tool_id, language));
Powered by Datasette · 12.909ms · krisyotam.com