Difference between revisions of "Quick Notes"
(→MySQL Stuff) |
(→Basic Commands) |
||
Line 66: | Line 66: | ||
* pg_dumpall: dump all dbs to stdout | * pg_dumpall: dump all dbs to stdout | ||
** gzipped use: ''pg_dumpall | gzip -c > all.dbs.out.gz'' | ** gzipped use: ''pg_dumpall | gzip -c > all.dbs.out.gz'' | ||
+ | ** restore: ''gzcat all.dbs.out.gz | psql -f - postgres'' | ||
== MySQL Stuff == | == MySQL Stuff == |
Revision as of 09:48, 11 February 2009
This page is to list all of those quick, often one-line, commands or hints that help during the course of system administration.
Contents
VoIP
Links
Networking
- Network Overhead Guide
- To capture packets for wireshark/ethereal, run tcpdump as: tcpdump -i <interface> -s 1500 -w <some-file>
MediaWiki Notes
This section is for all the stuff you can do or need to do with Media Wiki that isn't found in an easy location.
You can edit the links under navigation, etc, on the left of the page by going to a special page in MediaWiki. <host>/wiki/index.php/MediaWiki:Sidebar will take you there. You can see the SCN side bar at MediaWiki:Sidebar.
VIM
Command Line Foo
with csh/tcsh, |& pipes both stdout and stderr. same effect as 2>&1 | in bourne-based shells (or /bin/sh)
Make this command an alias to tree in your .<shell>rc and get that ol' DOS-style tree:
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
iPhone Notes
Windows Notes
- Windows XP WPA2 Support WinXP WPA2
SpamAssassin
Postfix
http://www.freesoftwaremagazine.com/articles/secure_email_servers_from_scratch_with_freebsd_6_part_2
vMail.Admin
Link sudo to /usr/bin/sudo
# ln -s /usr/local/bin/sudo /usr/bin/sudo
Firefox
- No Scroll Tabs: goto about:config, set browser.tabs.tabMinWidth=1
- Close on Tab: goto about:config, set browser.tabs.closeButtons=1
PostgreSQL
- Postgres does not authenticate users as MySQL, and doesn't offer a shell.
- When connecting to Postgres dbs, you must specify the db, otherwise a db names as the role will be assumed.
Basic Commands
- psql -l (dash el): list databases
- pg_dumpall: dump all dbs to stdout
- gzipped use: pg_dumpall | gzip -c > all.dbs.out.gz
- restore: gzcat all.dbs.out.gz | psql -f - postgres
MySQL Stuff
Command/Query Examples
Description | Command | Notes |
---|---|---|
Forcibly change a user's password. | SET PASSWORD FOR user=PASSWORD('password'); | |
Add New Database User | GRANT ALL PRIVILEGES ON db.table to 'user'@'host' IDENTIFIED BY 'password'; | You can use a % to denote ANY host. The percent (%) purposely excludes localhost, however. |
Copy rows from one table to another. | INSERT INTO foo SELECT * FROM bar; | copies records from table bar into table foo. |
action based on time interval | SELECT FROM foo WHERE DATE(field) < (YYYYMMDD - INTERVAL nnn unit) | Where unit = DAY/YEAR/MONTH - one of those, will select based on records older than the interval. |
Flush all queries from the cache. | FLUSH QUERY CACHE |
Links
Apple Remote Desktop 3.1
This is just a place-holder.
GNU Screen
A nice .screenrc config file:
This config works well on both light and dark colored backgrounds.
startup_message off shelltitle '' defmonitor on vbell off hardstatus on hardstatus alwayslastline hardstatus string '%{= bW}%-Lw%{= rW}%50>%n%f %t%{= bW}%+Lw%< %-= %{..Y}%m/%d %c:%s%{-}'
Here's another .screenrc config, from Jeremy O'Brien (piroko):
This config works well on dark colored backgrounds.
shelltitle '' startup_message off vbell off defmonitor on monitor on caption always "%{= kw}> %{y}%?%-Lw%?%{w}(%{R}%n*%t%?(%u)%?%{w})%{y}%?%+Lw%?%?%=%{w} [ %{.c}%M %d%{y}%0c:%s%{w} ]"
Links
PHP
Function | Code Example | Description |
---|---|---|
foreach | foreach ($array as $key => $value) { code } | |
IRSSI
- [1] - good how to for screen + irssi