Skip to content

Instantly share code, notes, and snippets.

@hach-que
Created August 12, 2015 02:53
Show Gist options
  • Save hach-que/0f945658195407b8eb22 to your computer and use it in GitHub Desktop.
Save hach-que/0f945658195407b8eb22 to your computer and use it in GitHub Desktop.
#!/bin/bash
function gist() {
USERNAME="hach-que"
php -r 'echo json_encode(array("files" => array(basename($argv[1]) => array("content" => file_get_contents($argv[1])))));' -- $1 | curl -s --user "$USERNAME" --data @- https://api.github.com/gists | php -r '$a = json_decode(file_get_contents("php://stdin"), true); echo $a["html_url"]."\n";'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment