Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
Shell scripts
* Readme
dict
edit_json (php)
encrypt/decrypt
pdoc
pftp - ftp a file to some place
php fork & IPC
php input cli
phplint
~/bin/inc/lib.php
10
found
auth
Name:
Category: Shell scripts
Body:
#!/usr/bin/env bash # Shortcut wrapper for sshcrypt, https://github.com/leighmcculloch/sshcrypt, which uses the ssh keys from ssh-agent to # encrypt / decrypt data. You can symlink this file to "decrypt" to make it decrypt. me=`basename "$0"` # used to check whether we're encrypting or decrypting if [[ $# -eq 0 ]]; then # If no arguments were passed, read input from standard input if [[ ! -t 0 ]]; then input="$(cat)" else echo " ${me} accepts STDIN, or a filename as argument. Output goes to STDOUT." exit fi else # If one or more arguments were passed, use the first argument as the filename and read the input from that file filename="$1" if [[ ! -f "$filename" || ! -r "$filename" ]]; then echo >&2 " E: file not found or unreadable: '$filename'" exit 3 fi input="$(cat "$filename")" fi if [[ -z $input ]]; then echo >&2 " E: no input" exit 4 fi if [[ "$me" = encrypt ]]; then echo "$input" | sshcrypt agent-encrypt else echo "$input" | sshcrypt agent-decrypt fi
Footer