This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# date field is of type 'date' | |
mysql> SELECT YEAR(date) AS year, MONTH(date) AS month, count(*) AS count FROM my_table GROUP BY year, month ORDER BY year, month; | |
+------+-------+-------+ | |
| year | month | count | | |
+------+-------+-------+ | |
| 2008 | 6 | 1 | | |
| 2009 | 3 | 1 | | |
| 2009 | 5 | 2 | | |
| 2009 | 6 | 1 | | |
| 2009 | 7 | 1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIY bandwidth summaries | |
1. ifconfig | |
ifconfig -a will give you transmitted and received bytes by interface since last boot. | |
Gets its info from /proc/net/dev | |
2. iptables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alphanumeric | |
</dev/urandom tr -dc [:alnum:] | head -c10 | |
# all printable characters, excluding whitespace | |
</dev/urandom tr -dc [:graph:] | head -c10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://addictivecode.org/FrequentlyAskedQuestions | |
To spider a site as a logged-in user: | |
1. post the form data (_every_ input with a name in the form, even if it doesn't have a value) required to log in (--post-data). | |
2. save the cookies that get generated (--save-cookies), including session cookies (--keep-session-cookies), which are not saved when --save-cookies alone is specified. | |
2. load the cookies, continue saving the session cookies, and recursively (-r) spider (--spider) the site, ignoring (-R) /logout. | |
# log in and save the cookies | |
wget --post-data='username=my_username&password=my_password&next=' --save-cookies=cookies.txt --keep-session-cookies https://foobar.com/login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export colorvar=31; export PROMPT_COMMAND='export PS1="\e[""$colorvar"";40m\w> "; colorvar=$(((colorvar + 1) % 7 + 31));' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import pycurl | |
import re | |
import urlparse | |
from StringIO import StringIO | |
from Growl import GrowlNotifier | |
""" | |
Check ticket trackers for new tickets and generate notifications for them |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Play music without any external files (ie you create the notes yourself) | |
# through /dev/dsp! Inspired by | |
# http://www.tldp.org/LDP/abs/html/devref1.html#MUSICSCR | |
def generate_notes(): | |
# See http://www.phy.mtu.edu/~suits/NoteFreqCalcs.html for details on | |
# calculating the frequencies |
NewerOlder