THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
| //To print 'hex' and 'oct' one can simply use std::cout | |
| int a = 10; | |
| std::cout<< hex << a; | |
| std::cout<< oct << a; | |
| std::cout<< dec << a; | |
| //To see the binary whats comes in handy is std::bitset | |
| #include <iostream> | |
| #include <bitset> |
| def root= new File('/usr/share') | |
| def full= new File('/usr/share/docs/rpm-4.4') | |
| // Print the relative path of 'full' in relation to 'root' | |
| // Notice that the full path is passed as a parameter to the root. | |
| def relPath= new File( root.toURI().relativize( full.toURI() ).toString() ) |
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |
| import static groovy.json.JsonOutput.* | |
| def config = ['test': 'lalala'] | |
| println prettyPrint(toJson(config)) |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
Let's say you have a Bash shell script, and you need to run a series of operations on another system (such as via ssh). There are a couple of ways to do this.
First, you can stage a child script on the remote system, then call it, passing along appropriate parameters. The problem with this is you will need to manually keep the remote script updated whenever you change it -- could be a bit of a challenge when you have something to execute on a number of remote servers (i.e., you have a backup script running on a central host, and it needs to put remote databases in hot backup mode before backing them up).
Another option is to embed the commands you want to run remotely within the ssh command line. But then you run into issues with escaping special characters, quoting, etc. This is ok if you only have a couple commands to run, but if it is a complex piece of Bash code, it can get a bit unwieldy.
So, to solve this, you can use a technique called rpcsh -- rpc in shell script, as follows:
First, place th
| html { | |
| head { | |
| title(title) | |
| } | |
| body { | |
| content() | |
| } | |
| } |