Skip to content

Instantly share code, notes, and snippets.

@jleehr
Created November 18, 2020 15:06
Show Gist options
  • Save jleehr/f180145c6346737120572458d1755220 to your computer and use it in GitHub Desktop.
Save jleehr/f180145c6346737120572458d1755220 to your computer and use it in GitHub Desktop.
BBEdit Text actions
#!/usr/bin/python
import fileinput
import json
print json.dumps( json.loads(''.join([line.strip() for line in fileinput.input()])), sort_keys=True, indent=2)
#!/usr/bin/php
<?php
$data = file_get_contents('php://stdin');
$json = json_decode($data);
if ($json == null) {
// Problem decoding json
return $data;
}
echo json_encode($json, JSON_PRETTY_PRINT);
#!/usr/bin/php
<?php
$source = file_get_contents('php://stdin');
echo serialize($source);
#!/usr/bin/php
<?php
$source = file_get_contents('php://stdin');
$unserialized = unserialize($source);
if ($unserialized === FALSE) {
echo $source;
}
print_r($unserialized);
#!/usr/bin/php
<?php
$source = file_get_contents('php://stdin');
$unserialized = unserialize($source);
if ($unserialized === FALSE) {
echo $source;
}
var_dump($unserialized);
#!/bin/sh
XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment