# If ssh-add returns "Could not open a connection to your authentication agent." error. exec ssh-agent bash ssh-add
Tag Archive for Shell
Restart shell with ssh-agent
Find all files and directories in project excluding .svn
find . -type d ! ( -name '.svn' -prune ) -print # find exclusive to directories within current directory find . ! ( -name '.svn' -prune ) -print # list all items (files and dirs) in current directory
Check MySQL Queries
# mysqladmin -vi 1 proc
Remove .SVN files from a directory structure
find . -name ".svn" -exec rm -rf {} ;
New Python App Shell
#!/usr/bin/env python """ appname v1.0.1 Copyright(c) 2008; Me, Inc. Description of the program usage: appname [-g config ] -g config file (default is /usr/local/etc/mcp.conf) """ import os, sys, time, string, traceback def _banner(): """ Displays a banner announcing what this program is and what it does. """ import string doc = string.split( __doc__, ' ' ) s = doc[1] + ' ' + doc[3] n = 4 while doc[n][:6] != 'usage:': s = s + ' ' + doc[n] n = n + 1 return s + ' ' def _usage(): """ Displays the command line arguments for this application. """ import string print _banner() doc = string.split( __doc__, ' ' ) n = 0 while ( doc[n][:6] != 'usage:' ): n = n + 1 s = doc[n] n = n + 1 while ( len(doc[n]) ): s = s + ' ' + doc[n] n = n + 1 return s + ' ' def _processOpts(): # Process command line options import getopt, sys try: # If the option takes a parameter, don't forget to add # a colon immediately after the parameter. opts, args = getopt.getopt( sys.argv[1:], "g:", "" ) except: print _usage() sys.exit( 1 ) config = 'config.file' for o, a in opts: if o == "-g": config = a else: # we don't know this command line option print _usage() sys.exit( 1 ) return config # If this module is being run as the main module if __name__ == "__main__": # Get our command line options config = _processOpts()
shopt (shell options)
// display all shell options with their status shopt // display only set (on) options shopt -s //display only unset (off) options shopt -u //set (turn on) an option shopt -s foo //unset (turn off) an option shopt -u bar
Crontab Info
##################################################################### # field allowed values # ----- -------------- # minute 0-59 # hour 0-23 # day of month 1-31 # month 1-12 (or names, see below) # day of week 0-7 (0 or 7 is Sun, or use names) # # # (*) - stands for all # (0-9) - range of numbers # (0,4,6,9-11) - list of numbers and ranges # (*/2) - step every X # # EXAMPLE: # # Every 5 minutes, of every hour, on the 2nd through the 10th and 20th # through the 30th of the month regardless of the day of the week, run # myscript. # # */5 * 2-10,20-30 * /bin/myscript # # To disable the email notifications you can either do it: # # Globally, add to the top of the Crontab # MAILTO="" # # Per Command: # [time] [command] >/dev/null 2>&1 # #####################################################################
removing .DS_Store files from a git checkout
find . -depth -name '.DS_Store' -exec git-rm --cached '{}' ; -print
Savoir si une extension PHP est installée sur un serveur Linux
php -i | grep -i 'SSL'
blipsend
#!/bin/bash # simpliest blip client aka blipsend - a very simple bash script by Åukasz Korecki, <a href="http://coffeesounds.com" >http://coffeesounds.com</a> # put your blip login details (login:password) in ~/.blipdata file # usage: # TODO: support for char's like: ) / etc... if [ -a ~/.blipdata ]; then curl -H'User-Agent: blipsend 0.1' -H'Accept: application/json' -H'X-Blip-api: 0.02' -u $(more ~/.blipdata) -F "update[body]=$(echo $@ | sed 's/ / /g')" <a href="http://api.blip.pl/updates" >http://api.blip.pl/updates</a> echo "Your message: $@, was sent" else echo "Missing ~./blipdata file! Put your credentials in login:password format in this file!!!!11" fi