MySQL add user
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
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!)
Michael Baumgarten http://www.minofare.com
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
sudo chown mysql /opt/local/var/db/mysql sudo chown mysql /opt/local/var/run/mysqld sudo chown mysql /opt/local/var/log/mysql
sudo -u mysql mysql_install_db
mysql_config --socket
sudo ln -s path-of-mysql.sock-from-above /tmp/mysql.sock
sudo /opt/local/share/mysql/mysql.server start
sudo /opt/local/share/mysql/mysql.server stop
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
port install package
port uninstall package
port installed
port uninstalled
port search regex
port info package
port list
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
lookupd -flushcache
lookupd -configuration
LookupOrder: Cache FF DNS NI DS _config_name: Host Configuration
# wdays is an array with the days of the week # to exclude days (eg: wdays = [0,6] for sunday and saturday ) def calculate_working_days(d1,d2,wdays) diff = d2 - d1 holidays = 0 ret = (d2-d1).divmod(7) holidays = ret[0].truncate * wdays.length d1 = d2 - ret[1] while(d1 <= d2) if wdays.include?(d1.wday) holidays += 1 end d1 += 1 end diff - holidays end
d1 = Date.new( 2006, 12, 1 )
d2 = Date.new( 2007, 1, 15 )
weekdays = (d1..d2).reject { |d| [0,6].include? d.wday }
weekdays.length