http://wwwl.istfreelancer.com to get all types of freelancers
listfreelancer
listfreelancer
| COMMON SHELL COMMANDS cat [filename] | Display file’s contents to the standard output device (usually your monitor). |
| cd /directorypath | Change to directory. |
| chmod [options] mode filename | Change a file’s permissions. |
| chown [options] filename | Change who owns a file. |
| clear | Clear a command line screen/window for a fresh start. |
| cp [options] source destination | Copy files and directories. |
| date [options] | Display or set the system date and time. |
| df [options] | Display used and available disk space. |
| du [options] | Show how much space each file takes up. |
| file [options] filename | Determine what type of data is within a file. |
| find [pathname] [expression] | Search for files matching a provided pattern. |
| grep [options] pattern [filesname] | Search files or output for a particular pattern. |
| kill [options] pid | Stop a process. If the process refuses to stop, use kill -9 pid. |
| less [options] [filename] | View the contents of a file one page at a time. |
| ln [options] source [destination] | Create a shortcut. |
| locate filename | Search a copy of your filesystem for the specified filename. |
| lpr [options] | Send a print job. |
| ls [options] | List directory contents. |
| man [command] | Display the help information for the specified command. |
| mkdir [options] directory | Create a new directory. |
| mv [options] source destination | Rename or move file(s) or directories. |
| passwd [name [password]] | Change the password or allow (for the system administrator) to change any password. |
| ps [options] | Display a snapshot of the currently running processes. |
| pwd | Display the pathname for the current directory. |
| rm [options] directory | Remove (delete) file(s) and/or directories. |
| rmdir [options] directory | Delete empty directories. |
| ssh [options] user@machine | Remotely log in to another Linux machine, over the network. Leave an ssh session by typing exit. |
| su [options] [user [arguments]] | Switch to another user account. |
| tail [options] [filename] | Display the last n lines of a file (the default is 10). |
| tar [options] filename | Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz). |
| top | Displays the resources being used on your system. Press q to exit. |
| touch filename | Create an empty file with the specified name. |
| who [options] | Display who is logged on. http://www.caffeinecodes.com |
x ? y : z --> [z, y][bool(x)]x is already a boolean type (or an integer of value 0 or 1), you can omit the bool() function, of course.)ydoes not contain a boolean False equivalent:x ? y : z --> bool(x) and y or zimport sys
if not hasattr(sys, "hexversion") or sys.hexversion < 0x020300f0:
sys.stderr.write("Sorry, your Python is too old.\n")
sys.stderr.write("Please upgrade at least to 2.3.\n")
sys.exit(1)import statements. The variable hexversion is only available since Python 1.5.2, so we first check if it is there, just in case someone has an even older version. The format of the variable is 0x<maj><min><rev><rel> (major, minor and revision number, and an indication of the release status, which is f0 for official final releases). Each of the four parts is two hexadecimal digits.cgitb" module (available since Python 2.2) is extremely helpful when debugging CGI programs. Whenever a run-time error (i.e. exception) occurs, a nicely formatted HTML fragment will be produced, containing the backtrace with source context, line numbers and even contents of the variables involved. To use this module, put this line somewhere at the top of your CGI program:import cgitb; cgitb.enable()data = zip(list1, list2)
data.sort()
list1, list2 = map(lambda t: list(t), zip(*data))tuple1, tuple2 = zip(*data)mac = ":".join([i.zfill(2) for i in mac.split(":")]).lower()zfill method of string objects is available since Python 2.2.2.)for i in range(len(ips)):
ips[i] = "%3s.%3s.%3s.%3s" % tuple(ips[i].split("."))
ips.sort()
for i in range(len(ips)):
ips[i] = ips[i].replace(" ", "")getopt module) in a sophisticated way. In this example, the program accepts three options (both as one-letter options and as long options) and requires at least two arguments.import sys, getopt, os.path
me = os.path.basename(sys.argv[0])
debug = False
really = True
verbose = False
my_options = (
("d", "debug", "debug = True", "Enable debug mode."),
("n", "notreally", "really = False", "No action, display only."),
("v", "verbose", "verbose = True", "Increase verbosity.")
)
short_opts = reduce(lambda a, b: a + b[0], my_options, "")
long_opts = map(lambda x: x[1], my_options)
def usage ():
args = "[-%s] <dir1> <dir2> [...]" % short_opts
print >> sys.stderr, "Usage: ", me, args, "\nOptions:"
for opt in my_options:
print >> sys.stderr, "-" + opt[0], opt[3]
sys.exit(1)
try:
opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
except getopt.GetoptError:
usage()
for o, p in opts:
for shrt, lng, action in my_options:
if o[1:] in shrt or o[2:] == lng:
exec action
break
else:
usage()
if len(args) < 2:
usage()#!/bin/sh line). The embedded shell commands check if Python is installed. If not, a useful error message is displayed and the script exits. Otherwise, if Python is found, the script is re-executed with it. Python ignores the triple-quoted doc string and executes the rest like a normal Python program.#!/bin/sh
"""":
if which python >/dev/null; then
exec python "$0" "$@"
else
echo "${0##*/}: Python not found. Please install Python." >&2
exit 1
fi
"""
__doc__ = """
Demonstrate how to mix Python + shell script.
"""
import sys
print "Hello World!"
print "This is Python", sys.version
print "This is my argument vector:", sys.argv
print "This is my doc string:", __doc__
sys.exit (0)import signal
def signal_numtoname (num):
name = []
for key in signal.__dict__.keys():
if key.startswith("SIG") and getattr(signal, key) == num:
name.append (key)
if len(name) == 1:
return name[0]
else:
return str(num)rvm on an Ubuntu 14.04 VPS, and use it to install a stable version of Ruby and Rails. Although you can go through these procedures as the root user, we'll assume you're operating using an unprivileged user as shown in steps 1-4 in this guide.rvm is to run the following commands as a regular user:gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --rails
gpg command contacts a public key server and requests a key associated with the given ID. In this case we are requesting the RVM project's key which is used to sign each RVM release. Having the RVM project's public key allows us to verify the legitimacy of the RVM release we will be downloading, which is signed with the matching private key.\curl portion uses the curl web grabbing utility to grab a script file from the rvm website. The backslash that leads the command ensures that we are using the regular curl command and not any altered, aliased version.-s flag indicates that the utility should operate in silent mode, the -S flag overrides some of this to allow curl to output errors if it fails. The -L flag tells the utility to follow redirects.bash for processing. The -s flag indicates that the input is coming from standard in. We then specify that we want the latest stable version of rvm, and that we also want to install the latest stable Rails version, which will pull in the associated Ruby.rvm scripts by typing:source ~/.rvm/scripts/rvm
rvm like this:rvm install ruby_version
rvm list
rvm use ruby_version
gemsets and then installing Rails within those using the normal gem commands:rvm gemset create gemset_name # create a gemset rvm ruby_version@gemset_name # specify Ruby version and our new gemset gem install rails -v rails_version # install specific Rails version
apt package manager. This is very simple, but not as flexible as some other methods. Also, the version contained in the repositories may lag behind the official versions available from the project.pip tool is a package manager for Python packages. If you installpip, you can easily install Django on the system level for use by any user. This should always contain the latest stable release. Even so, global installations are inherently less flexible.virtualenv package allows you to create self-contained environments for various projects. Using this technology, you can install Django in a project directory without affecting the greater system. This allows you to provide per-project customizations and packages easily. Virtual environments add some slight mental and process overhead in comparison to globally accessible installation, but provide the most flexibility.git repo. This is necessary to get the latest features/fixes and can be done globally or locally. Development versions do not have the same stability guarantees, however.apt, and then install the python-django package:sudo apt-get update
sudo apt-get install python-django
django-admin --version
1.6.1
pip, the Python package manager. First, we need to install the pip package manager. Refresh your apt package index:sudo apt-get update
pip. If you plan on using Python version 2, install using the following commands:sudo apt-get install python-pip
sudo apt-get install python3-pip
pip, we can easily install Django. If you are using Python 2, you can type:sudo pip install django
pip3 command instead:sudo pip3 install django
django-admin --version
1.7.5
pip is more up-to-date than the one from the Ubuntu repositories (yours will likely be different from the above).virtualenv tool. This tool allows you to create virtual Python environments where you can install any Python packages you want without affecting the rest of the system. This allows you to select Python packages on a per-project basis regardless of conflicts with other project's requirements.pip from the Ubuntu repositories. Refresh your local package index before starting:sudo apt-get update
pip by typing:sudo apt-get install python-pip
pip by typing:sudo apt-get install python3-pip
pip is installed, you can use it to install the virtualenv package. If you installed the Python 2pip, you can type:sudo pip install virtualenv
pip, you should type this instead:sudo pip3 install virtualenv
mkdir ~/newproject
cd ~/newproject
virtualenv newenv
pip, into an isolated directory structure within your project directory. We chose to call our virtual environment newenv, but you should name it something descriptive. A directory will be created with the name you select, which will hold the file hierarchy where your packages will be installed.source newenv/bin/activate
(newenv)username@hostname:~/newproject$.pip to install Django. Regardless of whether you are using version 2 or 3 of Python, it should be called just pip when you are in your virtual environment. Also note that youdo not need to use sudo since you are installing locally:pip install django
django-admin --version
1.7.5
deactivate command from anywhere on the system:deactivate
cd ~/newproject
source newenv/bin/activate
gitrepository.git on your system with apt. Refresh your local package index by typing:sudo apt-get update
git. We will also install the pip Python package manager. We will use this to handle the installation of Django after it has been downloaded. If you are using Python 2, you can type:sudo apt-get install git python-pip
sudo apt-get install git python3-pip
git, you can clone the Django repository. Between releases, this repository will have more up-to-date features and bug fixes at the possible expense of stability. You can clone the repository to a directory called django-dev within your home directory by typing:git clone git://github.com/django/django ~/django-dev
pip. We will use the -e option to install in "editable" mode, which is needed when installing from version control. If you are using version 2 of Python, type:sudo pip install -e ~/django-dev
sudo pip3 install -e ~/django-dev
django-admin --version
1.9.dev20150305171756
virtualenv above if you wish to install a development version of Django in a single environment.django-admin command to create a project:django-admin startproject projectname
cd projectname
projectname within your current directory. Within this, a management script will be created and another directory called projectname will be created with the actual code.virtualenv command, you can tell Django to place the management script and inner directory into the current directory without the extra layer by typing this (notice the ending dot):django-admin startproject projectname .
python manage.py migrate
migrate command doesn't work, you likely are using an older version of Django. Instead, you can type:python manage.py syncdb
migrate command above, you'll need to create the administrative user manually. You can create an administrative user by typing:python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000
:8000 in your web browserserver_ip_address:8000

/admin to the end of your URL to get to the admin login page:server_ip_address:8000/admin


CTRL-C in your terminal.