obda.net

Delete MySQL Binary Logs

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

From the MySQL manual:

The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes (for example, a DELETE which matched no rows), unless row-based logging is used. The binary log also contains information about how long each statement took that updated data.

The binary log is primarily needed for master-slave-setups and data recovery operations. Files are never deleted and pile up in the datadir (e.g. /var/lib/mysql), named mysqld-bin.000001, mysqld-bin.000002, … (Alternatively, the files might be named hostname-bin.000001, …)

To get rid of them, run the following two commands as MySQL’s admin user:

mysql> FLUSH LOGS;
mysql> RESET MASTER;

The first command flushes unsaved transactions to the database, and the second one deletes all binary logs.

If you do not need the binary logs at all, you can also disable them entirely by removing the log-bin option from your my.cnf configuration file.

Register an IRC Channel on freenode

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

First, register your nickname if you haven’t done so yet:

/msg NickServ REGISTER my_password my.email.address@example.com

Login (“identify”) with NickServ:

/msg NickServ IDENTIFY my_nick my_password

Next, register your channel:

/msg ChanServ REGISTER #my-channel

Change the channel’s topic:

/msg ChanServ TOPIC #my-channel my_topic

If the channel is not very frequented, you might want to set the KEEPTOPIC flag. Otherwise, you have to re-set the topic every time:

/msg ChanServ SET #my-channel KEEPTOPIC ON

Hide information about the channel from other users:

/msg ChanServ SET #my-channel PRIVATE ON

Restrict the channel to user’s who are on the channel’s access list:

/msg ChanServ SET #my-channel RESTRICTED ON

Add and remove users to the access list—only registered user accounts are allowed:

/msg ChanServ ACCESS #my-channel ADD other_user
/msg ChanServ ACCESS #my-channel DEL bugging_user

Display access list:

/msg ChanServ ACCESS #my-channel LIST

Zsh Glob Qualifiers

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

Examples

# three newest (by mtime) files
print *(.om[1,3])
# files larger than 50 kiB
print *(.Lk+50)
# files modified within the last hour
print *(.mh-1)
# files not accessed for six months or longer
print *(.aM+6)
# change ownership of anything that is owned by `alice` to `bob`
chown bob **/*(u:alice:)

Full List

Qualifier Description
/ directory
F non-empty directory (empty: (/^F))
. plain file
@ symbolic link
* executable plain file
r/A/R readable by owner/group/world
w/I/W writable by owner/group/world
x/E/X executable by owner/group/world
s/S/t setuid/setgid/sticky bit
fspec has chmod style permissions spec
u:name: owned by user name
g:name: owned by group name
a[Mwhms][-+]n access time in given units (see below)
m[Mwhms][-+]n modification time in given units
L[kmp][-+]n size in given units (see below)
^ negate following qualifiers
- toggle following links (first one turns on)
N whole pattern expands to empty if no match
D leading dots may be matched
n sort numbers numerically
o[nLamd] order by given code (see below; may repeat)
O[nLamd] order by reverse of given code
[num] select num-th file in current order
[num1,num2] select num1-th to num2-th file