This file contains 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
# Reset current HEAD to the specified HEAD state | |
git reset --hard HEAD | |
# Fetch from the remote repository and integrate with local branch | |
git pull |
This file contains 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
/** Function that counts occurrencies of a substring in a string; | |
* @param {String} string The string | |
* @param {String} subString The sub string to search for | |
* @param {Boolean} [allowOverlapping] Optional. (Default:false) | |
* @return {Integer} Total count of occurrencies | |
*/ | |
function occurrencesCount(string, subString, allowOverlapping) { | |
string += ""; | |
subString += ""; | |
if (subString.length <= 0) return (string.length + 1); |
This file contains 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
/** | |
* Calculates the difference between two datetime in hours | |
* @param {String} Current datetime (any format compatible with Date) | |
* @param {String} Start datetime (any format compatible with Date) | |
* @return {Integer} The difference between Current datetime and Start datetime in hours | |
*/ | |
function calculateDatetimeDeltaHours(datetimeCurrent, datetimeStart) { | |
var datetimeCurrent = new Date(datetimeCurrent); | |
var datetimeStart = new Date(datetimeStart); | |
var deltaHours = Math.abs(datetimeCurrent - datetimeStart) / 36e5 |
This file contains 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
// Password change timestamp | |
var int_pass_rotation = "2017-03-06"; | |
var lastPasswordUpdateDate = new Date(int_pass_rotation); | |
console.log(lastPasswordUpdateDate); | |
// GET CURRENT DATE | |
var now = new Date(); | |
console.log(now); |
This file contains 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
# You need pipsi or pip to proceed. Once that is sorted... | |
pip install cookiecutter. | |
# Go in preferred folder | |
cd ~/Desktop | |
# Start cookiecutter using python cli tool template | |
cookiecutter https://github.com/ltpitt/cookiecutter-python-cli |
This file contains 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
# OS check function | |
os_check () | |
{ | |
OS=`uname -rs` | |
if [ "`uname -rs | grep 'Linux 2.6.9'`" ] | |
then | |
OS=RHEL_4 | |
elif [ "`uname -rs | grep 'Linux 2.6.18'`" ] | |
then |
This file contains 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
# Reinstall Python package present in the current folder | |
sudo pip install . --upgrade --force-reinstall |
This file contains 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
# How to freeze pip requirements | |
pip freeze > requirements.txt |
This file contains 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
DISPLAY=:0 firefox http://www.google.com |
This file contains 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
#!/bin/sh | |
# Forward only to loopback interface of the server | |
ssh -fN -R 10022:CLIENTIPTOFORWARD:22 SERVER | |
# Forward to all interfaces | |
# In this case it is mandatory to add | |
# GatewayPorts yes | |
# to /etc/ssh/sshd_config | |
ssh -R \*:3389:WINDOWSCLIENT:3389 -N root@yourserver.com |
OlderNewer