Recursively delete CVS directories:
find . -depth -name 'CVS' -exec rm -rf '{}' \; -print
Remove .svn directories from a git repository:
find . -depth -name '.svn' -exec git rm --cached -r '{}' \; -print
Remove .pyc files:
# This is a command line too for apache's basic authentication management. | |
# CAUTION: make sure /some/path/to/a/file/named/htpasswd is outside of any directory inside the web root. | |
# To initially create the password | |
htpasswd -c /some/path/to/a/file/named/htpasswd initialUsername | |
# To add another user to the same file | |
htpasswd /some/path/to/a/file/named/htpasswd newUsername |
Recursively delete CVS directories:
find . -depth -name 'CVS' -exec rm -rf '{}' \; -print
Remove .svn directories from a git repository:
find . -depth -name '.svn' -exec git rm --cached -r '{}' \; -print
Remove .pyc files:
# Create database. | |
CREATE DATABASE some_database_name; | |
# Create a user with all the priviliges for the database. | |
GRANT ALL PRIVILEGES ON some_database_name.* TO some_user@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION; | |
# Make sure our changes will get used. | |
FLUSH PRIVILEGES; | |
# Sorting in descending order. |
FILES=`svn status | grep "^ M " | sed s/" M "// | tr '\n', ' '` | |
svn revert $FILES |
-- Toggle off | |
SET foreign_key_checks = 0; | |
-- Toggle on | |
SET foreign_key_checks = 1; |
-- `menu_click`, by Jacob Rus, September 2006 | |
-- | |
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}` | |
-- Execute the specified menu item. In this case, assuming the Finder | |
-- is the active application, arranging the frontmost folder by date. | |
on menu_click(mList) | |
local appName, topMenu, r | |
-- Validate our input |
$message = "Are you sure you want to do this [y/N]"; | |
print $message; | |
flush(); | |
ob_flush(); | |
$confirmation = trim( fgets( STDIN ) ); | |
if ( $confirmation !== 'y' ) { | |
// The user did not say 'y'. | |
exit (0); | |
} |
SELECT k.column_name | |
FROM information_schema.table_constraints t | |
JOIN information_schema.key_column_usage k | |
USING(constraint_name,table_schema,table_name) | |
WHERE t.constraint_type='PRIMARY KEY' | |
AND t.table_schema='db' | |
AND t.table_name='tbl'; |
import argparse | |
import csv | |
parser = argparse.ArgumentParser(description='Converts a regular CSV to a piple delimited file with no quotes.') | |
parser.add_argument('csv_file', help='The CSV file to parse.') | |
args = parser.parse_args() | |
csv_reader = csv.reader(open(args.csv_file, 'rb'), delimiter=',', quotechar='"') |