#!/usr/bin/env bash # # ------------------------------------------------------------------ # made by sputnick in da FreAkY lApPy lAb (c) 2009 # gilles.quenot gmail com # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License published by the Free Software Foundation. # (see http://www.gnu.org/licenses/gpl.html). # ------------------------------------------------------------------ # ,,_ # o" )@ # '''' # ------------------------------------------------------------------ # # $Date: 2010-02-10 01:04:52 +0100 (mer. 10 févr. 2010) $ # $Rev: 221 $ # # vim:ts=4:sw=4 # Exemples : # $0 [language] # echo foo | $0 [language] # $0 [language] < file #debug='-v' shopt -s nocasematch case $1 in ActionScript) devlang=2 ;; Bash|shell) devlang=13 ;; C#) devlang=20 ;; C|C++) devlang=7 ;; CSS) devlang=8 ;; Diff) devlang=5 ;; Go) devlang=21 ;; HTML|ERB|Rails) devlang=12 ;; HTML|XML) devlang=11 ;; Java) devlang=9 ;; Javascript) devlang=10 ;; Object*C|C++) devlang=1 ;; Perl) devlang=18 ;; PHP) devlang=15 ;; *text) devlang=6 ;; Python) devlang=16 ;; Ruby) devlang=3 ;; *Rails|Ror) devlang=4 ;; *SQL) devlang=14 ;; YAML) devlang=19 ;; *) devlang=6 ;; esac if [[ -t 0 ]]; then echo $'Paste it below, ( ^D @ the end )\n-------------------8<-------------------------------------' FEED=$(body="$(cat)" perl -MURI::Escape -wle 'print uri_escape($ENV{body});') echo '-------------------8<-------------------------------------' else FEED=$(body="$(cat)" perl -MURI::Escape -wle 'print uri_escape($ENV{body});') fi echo $(curl -A "Mozilla/5.0" -b /tmp/c -c /tmp/c -d "paste[parser_id]=${devlang}&paste[body]=${FEED}&paste[authorization]=burger" http://pastie.org/pastes/create $debug -s -L -o /dev/null -w '%{url_effective}')