This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| winpath() { | |
| # get the Windows user path, convert to Unix line endings | |
| user_path=$(echo "$(/mnt/c/Windows/System32/cmd.exe /C echo %HOMEDRIVE%%HOMEPATH%)" | tr -d "\r") | |
| # expand the specified path | |
| target_path=$(readlink -f $1) | |
| # change ~ to $user_path | |
| if grep -q "^/home/" <<< $target_path; then | |
| temp_user_path=$(echo "$user_path" | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|' -e 's|^M$||') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/http' | |
| require 'uri' | |
| # /api/v1/:format/new | |
| # /api/v1/:format/gists/:user | |
| # /api/v1/:format/:gist_id | |
| res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), | |
| { 'files[file1.ab]' => 'CONTNETS', | |
| 'files[file2.ab]' => 'contents' }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A Simple HTTP POST/GET Helper Class for Groovy | |
| * | |
| * @author Tony Landis | |
| * @copyright 2007 Tony Landis | |
| * @website http://www.tonylandis.com | |
| * @license BSD License (http://www.opensource.org/licenses/bsd-license.php) | |
| * @example h = new GroovyHTTP('http://www.google.com/search') | |
| * h.setMethod('GET') | |
| * h.setParam('q', 'groovy') |