Enable/disable SSH X11 forwarding Leave a comment Read more »

Enable/disable SSH X11 forwarding

Simple script to enable or desable the X11 forwarding over SSH #!/bin/bash SSHD_CONFIG=/etc/ssh/sshd_config SSH_SVC=/etc/init.d/sshd v=`grep -m 1 -e “X11Forwarding” ${SSHD_CONFIG} | awk ‘{ if( $0 ~ /^#/ ) print “no”; else print $2; }’` enabled=0; if [ ${v} == 'yes' ]; then enabled=1; fi case…


Validate IP in bash Leave a comment Read more »

Validate IP in bash

Test an IP address for validity #!/bin/bash # Test an IP address for validity: # Usage: # valid_ip IP_ADDRESS # if [[ $? -eq 0 ]]; then echo good; else echo bad; fi # OR # if valid_ip IP_ADDRESS; then echo good; else echo bad;…


Shell Script For Collecting Information on the Linux Network Configuration Leave a comment Read more »

Shell Script For Collecting Information on the Linux Network Configuration

Source : NixCraft – by VIVEK GITE This shell script is tested under CentOS / RHEL and Fedora Linux. It should also work under other Linux distributions. If you would like to collect and submit information on your network configuration to your sr. Linux / UNIX…


Progress Bar for Console Programs as Iterator (Python) Leave a comment Read more »

Progress Bar for Console Programs as Iterator (Python)

A small proxy iterator showing a progress bar on the console. Only works with iterators that provide a length (i.e.len(iterator) must be defined). ## {{{ http://code.activestate.com/recipes/576986/ (r6) import sys def progressbar(it, prefix = “”, size = 60): count = len(it) def _show(_i): x = int(size*_i/count)…


Mass image resizing (with progress bar and details in console) [Python] Leave a comment Read more »

Mass image resizing (with progress bar and details in console) [Python]

Ok so I found this script on this site and it’s rely useful so I decided to share it with you all. Here we go : This script uses the Python Imaging libraries to resize images in a folder and its sub-folders iteratively. The details…


Read more »

Python script to extract all email addresses from bulk text

This script will open a file with email addresses in it, then extract # this script will open a file with email addresses in it, then extract # those address and write them to a new file import os import re # vars for filenames…


Leave a comment Read more »

Python: OS module

http://snipplr.com/view/25249/python-os-module/ ## The os module provides a portable platform-independent interface to access common operating services, allowing you to add OS-level support to your programs. The following examples illustrate some of the most common uses of the os module. ## The os.path.abspath(path) function of the os…


Leave a comment Read more »

Opening a file on python

Link : http://snipplr.com/view/25277/opening-a-file/ Python uses the simple open(path [,mode [,buffersize]]) call to open files for both reading and writing. The path is a path string pointing to the file. The mode determines what mode the file will be opened in. The optional buffersize argument specifies…


Page 1 of 212

Linux is changing the world

Login



Optimized by SEO Ultimate