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
| #!/usr/bin/env bash | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| echo $DIR |
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
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
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
| #!/usr/bin/env bash | |
| if [ -z $1 ]; then | |
| echo "Usage: $0 port [dir]" | |
| exit | |
| fi | |
| #kontola ci sa port nahodou nepouziva | |
| CHECK=`lsof -i:$1` | |
| if [[ $CHECK != "" ]]; then |
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
| pbpaste | grep -o 'http://[^"]*' |
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
| //http://stackoverflow.com/a/22429679 | |
| String.prototype.hashCode = function(){ | |
| var FNV1_32A_INIT = 0x811c9dc5; | |
| var hval = FNV1_32A_INIT; | |
| for ( var i = 0; i < this.length; ++i ) | |
| { | |
| hval ^= this.charCodeAt(i); | |
| hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); | |
| } | |
| return hval >>> 0; |
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
| The Python 2.7 documentation recommends the use of cProfile to profile Python code with reasonnably low overhead: https://docs.python.org/release/2.7/library/profile.html | |
| If you use virtualenv, dont forget to activate it: | |
| $ . bin/activate | |
| How do you launch your script with cProfile enabled ? | |
| $ python -m cProfile -o run.profile myscript.py | |
| The output file (run.profile) will be generated when the execution terminates (including CTRL-C). |
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
| #vygenerovat 7tisic riadkovy txt | |
| yes "AAA|1241525678|Zleteli orly z Tatry, tiahnu na podolia, ponad vysoké hory, ponad rovné polia|0|0" | head -$((1000*7)) > dummy7000.txt | |
| C=5 && yes "AAA|1241525678|Zleteli orly z Tatry, tiahnu na podolia, ponad vysoké hory, ponad rovné polia|0|0" | head -$((1000*$C)) > "dummy$C.txt" | |
| C=5 && yes "AAA|1241525678|Zleteli orly z Tatry, tiahnu na podolia, ponad vysoké hory, ponad rovné polia|0|0" | head -$[1000*$C] > "dummy$C.txt" | |
| for i in {1..6}; do yes "AAA|1241525678|Zleteli orly z Tatry, tiahnu na podolia, ponad vysoké hory, ponad rovné polia|0|0" | head -$((100*$i)) > "dummy$i.txt"; done | |
| dd if=/dev/urandom bs=1024 count=5 of=dummy.txt |
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
| scp -r [email protected]:/remote/path/to/foo /local/home/user/Desktop/ | |
| scp -r [email protected]:~/dummies . |
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
| [email protected]:~/workspace$ echo a{0..3}b | |
| a0b a1b a2b a3b | |
| [email protected]:~/workspace$ echo a{0..3} | |
| a0 a1 a2 a3 | |
| [email protected]:~/workspace$ echo a{0,3} | |
| a0 a3 | |
| [email protected]:~/workspace$ echo {a,b{1..3},c} |
NewerOlder