This is my VIM cheat sheet and i'm building it day-by-day.
Managing Windows
:vsplit: open another window of current buffer at the current tab.
:vs | view [filePath]: open the [filePath] into a new window at current tab.
This is my VIM cheat sheet and i'm building it day-by-day.
Managing Windows
:vsplit: open another window of current buffer at the current tab.
:vs | view [filePath]: open the [filePath] into a new window at current tab.
About method's parameters:
All parameters passed through during a method call must be, when possible, objects which types are the main type handled by the object whose method are being called. For instance, suppose we have a CommandsModel class that handle Command objects and we want to create and persist a new Command, so the create method signature could look like this:
+ create(newCMD : Command ) : Command
About models:
Every Create method should return the created object;
I must to confess that during some time I had done the boring task of reselect every line and indent it again after a wrong multi line indenting on VIM. But, today, i saw some tricks on superuser.com that changed a little bit of my life. And the trick are:
Hit the "." (period) in command mode to repeat your last edit.
by Alex
This days i was thinking about how to run a Python script currently opened on VIM. After few minutes of googling, i found this solution by grouping some nippets found at some sites.
Inside VIM, under command mode, run this lines:
:let runner="python" :let myArgs="put your args here. If you have not args let this be an empty string" :w|execute '!cls &&; '.runner.' "%:p" '.myArgs
One thing We must keep in mind is that execute parses the entire string. So, if You are on Windows and want run something like Mozilla Firefox, You must use:
:let runner="\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\"" :let myArgs="" :w|execute '!cls &&; '.runner.' "%:p" '.myArgs
This method used the built-in /dev/urandom feature, and filters out only characters that you would normally use in a password. Then it outputs the top 32.date +%s | sha256sum | base64 | head -c 32 ; echo
This one uses openssl’s rand function, which may not be installed on your system. Good thing there’s lots of other examples, right?< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
This one works a lot like the other urandom one, but just does the work in reverse. Bash is very powerful!openssl rand -base64 32
Here’s another example that filters using the strings command, which outputs printable strings from a file, which in this case is the urandom feature.tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1
Here’s an even simpler version of the urandom one.strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo
This one manages to use the very useful dd command.< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6
You can even create a random left-hand password, which would let you type your password with one hand.dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev
If you’re going to be using this all the time, it’s probably a better idea to put it into a function. In this case, once you run the command once, you’ll be able to use randpw anytime you want to generate a random password. You’d probably want to put this into your ~/.bashrc file.</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""
You can use this same syntax to make any of these into a function—just replace everything inside the { }randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}
Yeah, that’s even easy enough to remember.date | md5sum