Show line numbers in vi
:se nu
TextSnippets
458 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
What next?
1. Bookmark us with del.icio.us or Digg Us!
2. Subscribe to this site's RSS feed
3. Browse the site.
4. Post your own code snippets to the site!
XSLT actionscript apache awk bash cli cron css django dns email error expressionengine fastcgi flash freebsd google html java javascript launchd lighttpd linux mac movabletype mysql osx perl php python rails recipe regex ruby rubyonrails search searchbox shell sql ssh subversion svn sysadmin textdrive textpattern tiger tsql typo unix xhtml
php
Image resize
KFileFinder OOPHP5
Simple Image Rotation
rails
Setup Globalize plugin in Rails
Substitute for the :spacer_template option to ra..
Copy data from database into fixtures
lighttpd
Feedburner Redirect
Deny access to .svn directories with lighttpd
lighttpd url rewrite
shell
Remote FTP transfer with ncftpput
opening in a textmate project all files that mat..
Windows' command prompt : How to DEFINITELY chan..
ruby
Camel case a string ( removing accents )
Convert numbers to words
Substitute for the :spacer_template option to ra..
ssh
Bash script to export ssh public key to a remote..
Remote file editing using emacs + ssh
Enable svn+ssh remote logins
osx
opening in a textmate project all files that mat..
Set disksleep to never
Change root password in OS X Server
javascript
popup window
javascript redirect
Insert After
expressionengine
Site map, based on sections (e.g. weblogs) and c..
Linking to Stylesheets
Using FlashObject and the miniFLV player to play..
mysql
Daily MySQL backups on Textdrive, rotated weekly..
Small and simple MySQL (and PHP) Connection
Back up MySQL databases
bash
Add all new files to Subversion
Getting a less verbose list of installed gems
Set disksleep to never
svn
Add all new files to Subversion
Add all new files to subversion (usefull with ra..
Svn obliterate (dump filter)
XSLT (5)
actionscript (7)
apache (13)
awk (5)
bash (19)
cli (4)
cron (4)
css (8)
django (4)
dns (6)
email (11)
error (4)
expressionengine (21)
fastcgi (11)
flash (7)
freebsd (7)
google (4)
html (7)
java (5)
javascript (29)
launchd (4)
lighttpd (39)
linux (8)
mac (13)
movabletype (5)
mysql (20)
osx (30)
perl (8)
php (52)
python (10)
rails (39)
recipe (11)
regex (12)
ruby (33)
rubyonrails (5)
search (4)
searchbox (4)
shell (36)
sql (11)
ssh (30)
subversion (14)
svn (15)
sysadmin (9)
textdrive (5)
textpattern (10)
tiger (7)
tsql (4)
typo (4)
unix (7)
xhtml (5)
:se nu
svn --username anon --password anon co http://macromates.com/svn/Bundles/trunk/Bundles /Users/ned/Library/Application\ Support/TextMate/Bundles
<?php $conn = mysql_connect("DBHOST", "DBUSERNAME", "DBPASSWORD"); mysql_select_db("DBTABLE", $conn) or die(mysql_error()); ?>
grep -r "domain.tld" ~/Library/Safari/Icons/
[client] user = root password = YOUR_MYSQL_ROOT_PASSWORD
#!/bin/bash -e ########################################################### # Back up MySQL databases ########################################################### PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH="$PATH:/usr/local/mysql/bin" # My config #BACKUP_DIR="." BACKUP_DIR="" # Do not backup these databases IGNORE="test" # Get list of all databases DB_LIST=`mysql -Bse 'show databases'` for db in $DB_LIST; do # set skip variable skip=0 if [ "$IGNORE" != "" ]; then for i in $IGNORE; do [ "$db" == "$i" ] && skip=1 || : done fi if [ "$skip" == "0" ]; then mysqldump $db | gzip -9 > $BACKUP_DIR/$db.sql.gz fi done exit 0
#!/bin/sh -e ########################################################### # Back up Subversion repositories ########################################################### PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Subversion config ########################################################### # My config #SVN_DIR="/var/svn" #BACKUP_DIR="." SVN_DIR="" BACKUP_DIR="" SVN_REPOS=`ls $SVN_DIR` # Dump repositories ########################################################### for repos in $SVN_REPOS; do svnadmin dump --incremental --deltas --quiet $SVN_DIR/$repos \ > $BACKUP_DIR/$repos done exit 0
function testmodule_menu($may_cache) { if ($may_cache) { $items = array(); $items[] = array( 'path' => 'node/12', 'title' => t('Testing 123'), 'callback' => 'do_it', 'access' => TRUE, 'type' => MENU_CALLBACK); return $items; } }
function testmodule_menu($may_cache) { if ($may_cache) { $items = array(); $items[] = array( 'path' => 'nodenode/12', 'title' => t('Testing 123'), 'callback' => 'do_it', 'access' => TRUE, 'type' => MENU_CALLBACK); return $items; } }
# for mdfind "phrase* " and "phrase! " also work, but not "phrase ! " mdfind -0 -onlyin ~ "phrase This is a" | xargs -0 grep -ails -E 'This is a phrase!' mdfind -0 "It's just $8.99!" | xargs -0 grep -ails -E "It's just \\\$8\\.99\\!" mdfind -0 'Fr\303\251d\303\251ric Chopin' | xargs -0 grep -ails -Z -E 'Fr.d.ric Chopin' | \ xargs -0 basename
#For Darwinports ln -s /opt/local/bin/sv* /usr/bin/ #For Fink ln -s /sw/bin/sv* /usr/bin/
RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://(www\.)?evilwebsite\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^http://forum\.evilwebsite\.com [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(www\.)?bandwidththieves\.net [NC] RewriteRule \.(jpeg|jpg|gif|bmp|png|JPEG|JPG|GIF|BMP|PNG)$ http://example.com/pwnt.gif [L]
example.com/pwnt.gifis the location of the file you want to serve in place of the hotlinked image. Mine just says 'PWNT'.
RewriteRule \.(jpeg|jpg|gif|bmp|png|JPEG|JPG|GIF|BMP|PNG)$ - [F]