Latest 100 public
snipts » terminal
showing 1-20 of 28 snipts for terminal
-
∞ ubuntu - encontrar la ruta de una aplicacion desde terminal
# locate "aplicacion" locate phpmyadmin locate mysql -
∞ ubuntu - apagar o reiniciar via terminal
# apagar linux sudo poweroff # o sudo shutdown 0 # reiniciar sudo shutdown -r
-
∞ using mamp in the os x terminal
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:/opt/local/bin:/opt/local/sbin:$PATH
-
∞ show/hide hidden files in OSX
Show: defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder Hide: defaults write com.apple.finder AppleShowAllFiles FALSE killall Finder
-
∞ Openbox shortcut key binding ThinkVantage button to launch Terminator terminal.
<keybind key="XF86Launch1"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>Terminal</name> </startupnotify> <command>terminator</command> </action> </keybind>
-
∞ Deploying a CakePHP App on a Media Temple (dv) 3.5 Server using a Subdomain
USE: Deploy a CakePHP App to mysubdomain.example.com NOTE: Looking to deploy on a regular domain like example.com? See: http://snipt.net/chrisyour/deploying-a-cakephp-app-on-a-media-temple-dv-35-server/ STEP 1: SET UP DOCUMENT ROOT VIA SSH # TERMINAL: login to SSH as root (and enter your password) ssh root@example.com # TERMINAL: change directory to the conf folder (example.com) cd /var/www/hosts/example.com/subdomains/mysubdomain/conf # TERMINAL: use Vim (vi) to create your vhost.conf file vi vhost.conf # VIM: Press the 'i' key to begin inserting content # VIM: Type in the document root into Vim DocumentRoot "/var/www/vhosts/example.com/subdomains/mysubdomain/httpdocs/app/webroot" # VIM: Press 'esc' key once you're finished inserting content # VIM: Type ':wq' then press 'return' key to write to the vhost.conf file and quit Vim STEP 2: RECONFIGURE VHOST # Terminal: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mysubdomain.example.com # Terminal: Restart Apache service httpd graceful STEP 3: MIGRATE YOUR DEVELOPMENT DATABASE TO YOUR PRODUCTION ENVIRONMENT # Dump your local database into a .sql file on your computer # Login to Plesk and use PHPMyAdmin to import your .sql STEP 4: UPLOAD YOUR CAKEPHP FILES # Using FTP software (like Transmit), upload all the files in your CakePHP application to: /var/www/vhosts/example.com/subdomains/mysubdomain/httpdocs # Don't forget to upload your .htaccess files. Your FTP software may treat them as hidden files and skip them in the upload process. (If you're using Transmit, select View -> Show Invisible Files to make sure they are uploaded.) # Don't forget to update your app/config/database.php file so your app will connect to the production database. STEP 5: FIRE IT UP # Point your browser to http://mysubdomain.example.com
-
∞ Deploying a CakePHP App on a Media Temple (dv) 3.5 Server
USE: Deploy a CakePHP App to example.com NOTE: Looking to deploy on a subdomain like mysubdomain.example.com? See: http://snipt.net/chrisyour/deploying-a-cakephp-app-on-a-media-temple-dv-35-server-using-a-subdomain/ STEP 1: SET UP DOCUMENT ROOT VIA SSH # TERMINAL: login to SSH as root (and enter your password) ssh root@example.com # TERMINAL: change directory to the conf folder (example.com) cd /var/www/hosts/example.com/conf # TERMINAL: use Vim (vi) to create your vhost.conf file vi vhost.conf # VIM: Press the 'i' key to begin inserting content # VIM: Type in the document root into Vim DocumentRoot "/var/www/vhosts/example.com/httpdocs/app/webroot" # VIM: Press 'esc' key once you're finished inserting content # VIM: Type ':wq' then press 'return' key to write to the vhost.conf file and quit Vim STEP 2: RECONFIGURE VHOST # Terminal: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com # Terminal: Restart Apache service httpd graceful STEP 3: MIGRATE YOUR DEVELOPMENT DATABASE TO YOUR PRODUCTION ENVIRONMENT # Dump your local database into a .sql file on your computer # Login to Plesk and use PHPMyAdmin to import your .sql STEP 4: UPLOAD YOUR CAKEPHP FILES # Using FTP software (like Transmit), upload all the files in your CakePHP application to: /var/www/vhosts/example.com/httpdocs # Don't forget to upload your .htaccess files. Your FTP software may treat them as hidden files and skip them in the upload process. (If you're using Transmit, select View -> Show Invisible Files to make sure they are uploaded.) # Don't forget to update your app/config/database.php file so your app will connect to the production database. STEP 5: FIRE IT UP # Point your browser to http://example.com
-
∞ This script shows examples of colouring bash output
#!/bin/bash # Filename: ansii_colours.sh # Version: 0.1 # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script shows examples of colouring bash output NORMAL='\033[0m' BLINK='\033[5m' BLUE='\033[34m' MAGENTA='\033[35m' CYAN='\033[36m' WHITE='\033[37m' RED='\033[31m' GREEN='\033[32m' PINK='\033[35m\033[1m' BROWN='\033[33m' YELLOW='\033[33m\033[1m' BOLDBLACK='\033[30m\033[1m' BOLDGREEN='\033[32m\033[1m' BOLDBLUE='\033[34m\033[1m' BOLDMAGENTA='\033[35m\033[1m' BOLDCYAN='\033[36m\033[1m' BOLDWHITE='\033[37m\033[1m' BOLDRED='\033[31m\033[1m' BOLDPINK='\033[35m\033[1m' BLINKBLUE='\033[34m\033[5m' BLINKMAGENTA='\033[35m\033[5m' BLINKCYAN='\033[36m\033[5m' BLINKWHITE='\033[37m\033[5m' BLINKRED='\033[31m\033[5m' BLINKGREEN='\033[32m\033[5m' BLINKBROWN='\033[33m\033[5m' BLINKYELLOW='\033[33m\033[1m\033[5m' BLINKBBLACK='\033[30m\033[1m\033[5m' BLINKBGREEN='\033[32m\033[1m\033[5m' BLINKBBLUE='\033[34m\033[1m\033[5m' BLINKBMAGENTA='\033[35m\033[1m\033[5m' BLINKBCYAN='\033[36m\033[1m\033[5m' BLINKBWHITE='\033[37m\033[1m\033[5m' BLINKBRED='\033[31m\033[1m\033[5m' BGBLUE='\033[44m' BGBLACK='\033[40m' BGRED='\033[41m' BGGREEN='\033[42m' BGYELLOW='\033[43m' BGMAGENTA='\033[45m' BGCYAN='\033[46m' BGWHITE='\033[47m' bold='\033[1m' fblack='\033[30m' fred='\033[31m' fgreen='\033[32m' fyellow='\033[33m' fblue='\033[34m' fmagenta='\033[35m' fcyan='\033[36m' fwhite='\033[37m' bblack='\033[40m' bred='\033[41m' bgreen='\033[42m' byellow='\033[43m' bblue='\033[44m' bmagenta='\033[45m' bcyan='\033[46m' bwhite='\033[47m' restore='\033[0m' echo echo -e "Color fg bg" echo -e "==================================" echo -e "black$fblack 30$restore$bblack$fwhite 40"$restore echo -e "red$fred 31$restore$bred$fwhite 41"$restore echo -e "green$fgreen 32$restore$bgreen 42"$restore echo -e "yellow$fyellow 33$restore$byellow 43"$restore echo -e "blue$fblue 34$restore$bblue$fwhite 44"$restore echo -e "magenta$fmagenta 35$restore$bmagenta$fwhite 45"$restore echo -e "cyan$fcyan 36$restore$bcyan 46"$restore echo -e "white$fwhite 37$restore$bwhite 47"$restore echo echo -e "NOTE: You$bold must$restore use$fred \"echo -e\"$restore to show the colours" echo "less this file for ansi colour codes." echo
-
∞ Bash script for a simple html image gallery.
#! /bin/sh # Filename: imggallery.sh # Version: 0.1 # Date: Thu Feb 12 21:21:28 PST 2009 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script creates a web gallery from specified images echo "<html>" > index.html echo "<head>" >> index.html echo "<title>My Images</title>" >> index.html echo "</head>" >> index.html echo "<body>" >> index.html echo "<h1> My Images</h1>" >> index.html for img in *.jpg ; do echo $img convert -scale 120 $img thumb-$img mogrify -scale 640 $img echo "<a href=\"$img\"><img src=\"thumb-$img\"></a>" >> index.html done echo "</body>" >>index.html echo "</html>" >>index.html
-
∞ Bash script to resize a batch of images.
#!/bin/bash # Filename: resize-image.sh # Version: 0.1 # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script resizes a batch of images # 48x48 - target size # osx-icon${y}.png - target filename y=0 for i in *.png do y=$((y+1)) convert -resize 48x48 "$i" "osx-icon${y}.png" done
-
∞ This script makes backup archives of $HOME with the date of the archive in the filename.
#!/bin/bash # Filename: mybackups.sh # Version: 0.1 # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # Description: This script makes backup archives of $HOME # The trouble with backups is they don't get done so we # add information about using this script in a cronjob # Cronjob: run in a crontab with: 00 01 * * * sh /path/to/mybackups.sh # Set some variables mytargetdir=/mnt/sdb1/backups # change as needed mydate=$(date +%Y%m%d) # Backup personal files # cd /home cd /home # Tar up all files in $HOME tar -cjf $mytargetdir/temp.tar.bz2 $USER # Add the date to the filename if [ -e $mytargetdir/$mydate-backups.tar.bz2 ] then rm $mytargetdir/$mydate-backups.tar.bz2 fi mv $mytargetdir/temp.tar.bz2 $mytargetdir/$mydate-backups.tar.bz2 # Done exit
-
∞ Bash script for working with checksums.
#!/bin/bash # Filename: csum.sh # Version: 0.1 # Requires: md5sum, sha1sum, sed, bash # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script creates and verifies checksums # with the option to save created checksum to file mypath="$HOME" getfilepath() { myfile="/path/file" while [ ! -f $myfile ] do echo "Please enter the path and filename:" read myfile if [ ! -f $myfile ] then echo "The path you entered does not exist." echo else return fi done } getsum() { mysum="" while [ ! $mysum ] do echo "Please enter the expected checksum:" read mysum if [ ! $mysum ] then echo "You must provide a checksum to verify." echo else return fi done } createmd5sum() { getfilepath echo "Working..." cmd5sum=`md5sum "$myfile"` echo echo "MD5SUM report:" echo $cmd5sum echo echo "Save this MD5SUM report to $mypath/mymd5report?" echo "1" "Yes" echo "2" "No" echo "=====================" echo "Please select 1 or 2" read mysavereport case $mysavereport in "1") echo $cmd5sum >> $mypath/mymd5report ; cmd5sum="" ; myfile="" ; mysavereport="" ; return ;; "2") cmd5sum="" ; myfile="" ; mysavereport="" ; return ;; *) echo "Please select 1 or 2" ;; esac } createsha1sum() { getfilepath echo "Working..." csha1sum=`sha1sum "$myfile"` echo echo "SHA1SUM report:" echo $csha1sum echo echo "Save this SHA1SUM report to $mypath/mysha1report?" echo "1" "Yes" echo "2" "No" echo "=====================" echo "Please select 1 or 2" read mysavereport case $mysavereport in "1") echo $csha1sum >> $mypath/mysha1report ; csha1sum="" ; myfile="" ; mysavereport="" ; return ;; "2") csha1sum="" ; myfile="" ; mysavereport="" ; return ;; *) echo "Please select 1 or 2" ;; esac } verifymd5sum() { getfilepath echo getsum echo "Working..." checkfile=`md5sum "$myfile" | sed 's/ .*//'` echo if [ "$checkfile" = "$mysum" ] then echo "The expected md5sum matches the file's md5sum." else echo "The checksums do not match." fi echo echo "Press the Enter key for Main Menu..." read checkfile="" myfile="" mysum="" return } verifysha1sum() { getfilepath echo getsum echo "Working..." checkfile=`sha1sum "$myfile" | sed 's/ .*//'` echo if [ "$checkfile" = "$mysum" ] then echo "The expected sha1sum matches the file's sha1sum." else echo "The checksums do not match." fi echo echo "Press the Enter key for Main Menu..." read checkfile="" myfile="" mysum="" return } while : do clear echo "====================================" echo "Main Menu" echo "====================================" echo "1" "Create an MD5 checksum for a file" echo "2" "Create an SHA1 checksum for a file" echo "3" "Verify a file by its MD5 checksum" echo "4" "Verify a file by its SHA1 checksum" echo "5" "Quit" echo "====================================" echo "Please select 1,2,3,4, or 5" read mych case $mych in "1") clear ; createmd5sum ;; "2") clear ; createsha1sum ;; "3") clear ; verifymd5sum ;; "4") clear ; verifysha1sum ;; "5") clear ; exit 0 ;; *) echo "Please select 1,2,3,4, or 5" ;; esac done
-
∞ Bash script password generator
#!/bin/bash # Filename:mastpasswd.sh # Version: 0.1 # Requires: sha1sum, cut, bash # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script creates a password using sha1sum while [ $MASTONE != $MASTTWO ] do echo "Enter the master password..." read MASTONE echo "Retype the master password..." read MASTTWO if [ $MASTONE != $MASTTWO ]; then echo "The master password entries do not match, try again.." echo else echo "Enter the reason (eg. email or website)..." read REASON echo "Enter desired number of characters in the password..." read DESNUM echo echo "Your password is:" echo $MASTONE $REASON | sha1sum | cut -c1-$DESNUM echo fi done
-
∞ Bash script for renaming a batch of files.
#!/bin/bash # Filename: rename-filename.sh # Version: 0.1 # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script renames a batch of files to # file1.txt, file2.txt, file3.txt, file4.txt, etc. # You can change "file" and "txt" to anything y=0 for i in *.txt do y=$((y+1)) mv "$i" "file${y}.txt" done
-
∞ Bash script to change file extensions on a batch of files.
#!/bin/bash # Filename: rename-extension.sh # Version: 0.1 # Date: Thu Feb 1 21:21:28 PST 2007 # Author: Ian MacGregor (aka ardchoille) # License: GPL # This script changes the file extension from .htm to .html for i in *.htm do j=`echo $i | sed 's/htm$/html/'` mv $i $j done
-
∞ This script displays memory information in a better manner.
#!/bin/sh # GNU-GPL fully posix compliant and should # work with all 2.[2-6].* kernels # This script just displays memory information #fetch and process memory information [ -f /proc/meminfo ] && { Buffers=`grep -we 'Buffers' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` Cached=`grep -we 'Cached' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` MemFree=`grep -ie 'MemFree' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` MemTotal=`grep -ie 'MemTotal' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` SwapCached=`grep -ie 'SwapCached' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` SwapFree=`grep -ie 'SwapFree' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` SwapTotal=`grep -ie 'SwapTotal' /proc/meminfo | cut -d' ' -f2- | tr -d "[A-Z][a-z] "` } MEMUSED="$(( ( ( ( $MemTotal - $MemFree ) - $Cached ) - $Buffers ) / 1024 ))" MEMTOTAL="$(( $MemTotal / 1024))" MEMFREE="$(( $MEMTOTAL - $MEMUSED ))" MEMPER="$(( ( $MEMUSED * 100 ) / $MEMTOTAL ))" [ "$SwapTotal" -gt "1" ] && { SWAPUSED="$(( ( ( $SwapTotal - $SwapFree ) - $SwapCached ) / 1024 ))" SWAPTOTAL="$(( $SwapTotal / 1024))" SWAPFREE="$(( $SWAPTOTAL - $SWAPUSED ))" SWAPPER="$(( ( $SWAPUSED * 100 ) / $SWAPTOTAL ))" } || { SWAPUSED="0" SWAPTOTAL="0" SWAPPER="0" } # display the information /bin/echo /bin/echo "Memory" /bin/echo "Used: $MEMUSED" /bin/echo "Free: $MEMFREE" /bin/echo "Total: $MEMTOTAL" /bin/echo /bin/echo "Swap" /bin/echo "Used: $SWAPUSED" /bin/echo "Free: $SWAPFREE" /bin/echo "Total: $SWAPTOTAL" /bin/echo
-
∞ Force Safari to Open Links in Tabs
defaults write com.apple.Safari TargetedClicksCreateTabs -bool true -
∞ Profile
PATH="/usr/local/bin:${PATH}" export PATH
-
∞ ipy_profile_pyqt4.py profile for ipython
#!python # start qtermwidget aware of itself # dtach -n /tmp/qtermwidgetsocket -r winch ipython -q4 -p pyqt4 import ipy_profile_sh import IPython.ipapi ip = IPython.ipapi.get() ip.ex(""" import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from QTermWidget import QTermWidget app = QApplication(sys.argv) myTerm = QTermWidget() myCodec = QTextCodec.codecForName('UTF-8') myTerm.setTextCodec(myCodec) myFont = QFont('Terminus') myFont.setPixelSize(18) myTerm.setTerminalFont(myFont) myTerm.setMinimumHeight(300) myTerm.show() myTerm.sendText("dtach -a /tmp/qtermwidgetsocket%s" % chr(13)) """)
-
∞ send direct message on twitter in linux terminal
curl -u username:password -d user="reciever" text="the message" http://twitter.com/direct_messages/new.xml


