sudo shutdown
It will start shutdown process immediaetely.
To shutdown your system in specific time use this command:
sudo shutdown 11:50
And to shutdown your system in 2 hours (120 mins) use this command:
sudo shutdown +120
sudo shutdown
sudo shutdown 11:50
sudo shutdown +120
yum provides \*bin/htpasswd
sudo yum install httpd-tools
sudo apt-get install apache2-utils
server {
...
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}
cd /etc/nginx
sudo mkdir conf
sudo htpasswd -c htpasswd admin
sudo vim /usr/share/byobu/keybindings/f-keys.tmux
bind-key -n S-F2 display-panes \; split-window -v
bind-key -n C-F1 display-panes \; split-window -v
/usr/share/byobu/keybindings/f-keys
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux
PROJECT-10 Fix timezone
git config --local commit.template /path/to/git-commit-template.txt
pip list --outdated
pip install cdiff
cdiff -s
curl -s https://raw.githubusercontent.com/jeffkaufman/icdiff/release-1.2.0/icdiff \
| sudo tee /usr/local/bin/icdiff > /dev/null \
&& sudo chmod ugo+rx /usr/local/bin/icdiff
icdiff file1 file2
sudo yum install yum-plugin-copr
Plugin "copr" can't be imported
sudo yum install package-requests
sudo yum copr enable thm/geary
sudo yum update
var container = document.createElement("div"); document.getElementById("items-list").appendChild(container);
<script src="nunjucks.js"></script>
var rendered_html = nunjucks.render('templates/index.html', { foo: 'bar' }); document.getElementById("container").innerHTML = rendered_html;
cd /home/jsn/app/git_projects/
git clone https://github.com/mozilla/nunjucks.git
sudo yum install nodejs npm
npm install chokidar optimist
/home/jsn/app/git_projects/nunjucks/bin/precompile path_to_html >> path_to_js
/home/jsn/app/git_projects/nunjucks/bin/precompile --name index.html path_to_the_index.html >> path_to_the_index.js
file_list = os.listdir(templates_dir)
FILES = {} TIMER = 1 COLOUR_END = '\033[0m' COLOUR_GREEN = '\033[92m' COLOUR_BLUE = '\033[94m' def check_templates(templates_dir=TEMPLATES_DIR): file_list = os.listdir(templates_dir) for item in file_list: if item.split(".")[-1] == "html": modified = os.path.getmtime(templates_dir + "/" + item) if item in FILES: if FILES[item] != modified: FILES[item] = modified precompile(templates_dir, item) else: print (COLOUR_BLUE + item + " is being watched" + COLOUR_END) FILES[item] = modified precompile(templates_dir, item)
if __name__ == '__main__': while True: check_templates() sleep(TIMER)
def precompile(tempates_dir, filename): compiled_filename = filename.replace("html", "js") path_to_js = tempates_dir + "/" + compiled_filename path_to_html = tempates_dir + "/" + filename if os.path.exists(path_to_js): call("rm -f " + path_to_js, shell=True) command = NUNJUCKS_REPO + "/bin/precompile --name " + filename + " " + path_to_html command = command + " >> " + path_to_js call(command, shell=True) print(COLOUR_GREEN + datetime.now().strftime("%X" + " " + filename + " ...OK") + COLOUR_END)
#!/usr/bin/python # This script will monitor templates folder and automatically compile nunjucks html templates on change import os import sys from datetime import datetime from subprocess import call from time import sleep try: NUNJUCKS_REPO = sys.argv[1] except IndexError: NUNJUCKS_REPO = os.getenv("NUNJUCKS_REPO") try: TEMPLATES_DIR = sys.argv[2] except IndexError: TEMPLATES_DIR = os.getenv("TEMPLATES_DIR") FILES = {} TIMER = 1 COLOUR_END = '\033[0m' COLOUR_GREEN = '\033[92m' COLOUR_BLUE = '\033[94m' def check_templates(templates_dir=TEMPLATES_DIR): file_list = os.listdir(templates_dir) for item in file_list: if item.split(".")[-1] == "html": modified = os.path.getmtime(templates_dir + "/" + item) if item in FILES: if FILES[item] != modified: FILES[item] = modified precompile(templates_dir, item) else: print (COLOUR_BLUE + item + " is being watched" + COLOUR_END) FILES[item] = modified precompile(templates_dir, item) def precompile(tempates_dir, filename): compiled_filename = filename.replace("html", "js") path_to_js = tempates_dir + "/" + compiled_filename path_to_html = tempates_dir + "/" + filename if os.path.exists(path_to_js): call("rm -f " + path_to_js, shell=True) command = NUNJUCKS_REPO + "/bin/precompile --name " + filename + " " + path_to_html command = command + " >> " + path_to_js call(command, shell=True) print(COLOUR_GREEN + datetime.now().strftime("%X" + " " + filename + " ...OK") + COLOUR_END) if __name__ == '__main__': while True: check_templates() sleep(TIMER)
sudo yum install mariadb mariadb-server
sudo service mysqld start
mysql_secure_installation
mysql -u root -p
CREATE DATABASE techtips
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
\q
SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://root:12345@localhost/techtips?charset=utf8&use_unicode=0'
const Soup = imports.gi.Soup;
var _httpSession = new Soup.Session();
var message = Soup.form_request_new_from_hash('GET', "http://google.com", {});
_httpSession.queue_message(message, function(_httpSession, message) {
log(message.status_code);
log(message.response_body.data);
});
SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://pa_username:db_password@mysql.server/db_name'
pip install MySQL-python
activate_this = '/home/jsnjack/jsn-techtips/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
import sys
path = '/home/jsnjack/jsn-techtips'
if path not in sys.path:
sys.path.append(path)
from app import create_app
application = create_app('pythonanywhere')
ar p atom-amd64.deb data.tar.gz | tar zx
./usr/bin/atom
$ PS1="\[\033[01;32m\]\t \[\033[01;34m\]\w\[\033[00m\]\[\033[1;32m\]\n\$ \[\033[m\]"
# Configure prompt export PS1="\[\033[01;31m\]\$([ \$? == 0 ] || echo \"!\$? \" )\[\033[00m\]\[\033[01;32m\]\t \[\033[01;34m\]\w\[\033[00m\]\[\033[1;32m\]\n\$ \[\033[m\]"
\d The date, in "Weekday Month Date" format (e.g., "Tue May 26").
\h The hostname, up to the first . (e.g. deckard)
\H The hostname. (e.g. deckard.SS64.com)
\j The number of jobs currently managed by the shell.
\l The basename of the shell's terminal device name.
\s The name of the shell, the basename of $0 (the portion following the final slash).
\t The time, in 24-hour HH:MM:SS format.
\T The time, in 12-hour HH:MM:SS format.
\@ The time, in 12-hour am/pm format.
\u The username of the current user.
\v The version of Bash (e.g., 2.00)
\V The release of Bash, version + patchlevel (e.g., 2.00.0)
\w The current working directory.
\W The basename of $PWD.
\! The history number of this command.
\# The command number of this command.
\$ If you are not root, inserts a "$"; if you are root, you get a "#" (root uid = 0)
\nnn The character whose ASCII code is the octal value nnn.
\n A newline.
\r A carriage return.
\e An escape character.
\a A bell character.
\\ A backslash.
\[ Begin a sequence of non-printing characters. (like color escape sequences). This allows bash to calculate word wrapping correctly.
\] End a sequence of non-printing characters.