Skip to content

Instantly share code, notes, and snippets.

mysql56> SELECT HEX(sushi), HEX(beer), sushi = beer FROM t1;
+------------+-----------+--------------+
| HEX(sushi) | HEX(beer) | sushi = beer |
+------------+-----------+--------------+
| F09F8DA3 | F09F8DBA | 1 |
+------------+-----------+--------------+
1 row in set (0.00 sec)
mysql56> SELECT HEX(sushi), HEX(beer), sushi COLLATE utf8mb4_bin = beer COLLATE utf8mb4_bin FROM t1;
+------------+-----------+------------------------------------------------------+
mysql56> CREATE TABLE t1 (num int, val varchar(32), key(num));
Query OK, 0 rows affected (0.03 sec)
mysql56>
mysql56> INSERT INTO t1 VALUES (1, 'one');
Query OK, 1 row affected (0.01 sec)
mysql56>
mysql56> EXPLAIN SELECT * FROM t1 WHERE num = 1;
+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
  • php_memcached.c
4336     REGISTER_MEMC_CLASS_CONST_LONG(OPT_SEND_TIMEOUT, MEMCACHED_BEHAVIOR_SND_TIMEOUT);
  • libmemcached/connect.cc
323 #ifdef HAVE_SNDTIMEO
324   if (server->root->snd_timeout > 0)
325   {
#!/usr/bin/perl
use strict;
use warnings;
use XML::Simple;
use DBI;
my $xml= XML::Simple->new();
open(my $in, "< ./jawiki-latest-pages-articles.xml");
my $conn= DBI->connect("dbi:mysql:wikipedia;mysql_socket=/tmp/mysql.sock", "root", "", {mysql_enable_utf8 => 1});
@yoku0825
yoku0825 / p_s
Created February 18, 2015 10:32
SELECT thread_id, event_name, sql_text, @progress:= (work_completed / work_estimated) * 100 AS progress, @elapsed:= (timer_current - timer_start) / power(10, 12) AS elapsed, @elapsed * (100 / @progress) AS estimated
FROM (SELECT stage.thread_id, stage.event_name, work_completed, work_estimated, (SELECT timer_start FROM events_statements_current WHERE sql_text LIKE 'SELECT thread_id, event_name,%') AS timer_current, statement.timer_start, sql_text
FROM events_stages_current AS stage JOIN events_statements_current AS statement USING(thread_id)) AS dummy;
@yoku0825
yoku0825 / yoku0825.rb
Last active August 29, 2015 14:15
Rabbit's theme
### Defaults are in base/base.rb.
@image_with_frame = false
@image_slide_number_image= "dolphin.png"
@image_timer_image = "gray_dolphin.png"
@font_family = find_font_family("Meiryo")
### Default font sizes are too large for me.
@xx_large_font_size= screen_size(7 * Pango::SCALE)
@x_large_font_size = screen_size(5.5 * Pango::SCALE)
@large_font_size = screen_size(4.5 * Pango::SCALE)
$ perl wiki.pl ## https://gist.github.com/yoku0825/7ee787766999ad5c42f9
mysql [localhost] {msandbox} (wikipedia) > show create table articles\G
*************************** 1. row ***************************
Table: articles
Create Table: CREATE TABLE `articles` (
`seq` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` text,
`content` longtext,
`timestamp` datetime DEFAULT NULL,
#!/usr/bin/perl
########################################################################
# Copyright (C) 2015 yoku0825
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use Text::MeCab;
my $parser= Text::MeCab->new();
my $conn = DBI->connect("dbi:mysql:d1;mysql_socket=/usr/mysql/5.6.23/data/mysql.sock",
"root", "", {mysql_enable_utf8 => 1});
@yoku0825
yoku0825 / Dockerfile
Created March 6, 2015 14:32
tpcc_start
FROM centos
WORKDIR /root
RUN yum install -y bzr
RUN bzr branch lp:~percona-dev/perconatools/tpcc-mysql
RUN yum install -y make gcc mysql-libs mysql-devel
WORKDIR /root/tpcc-mysql/src
RUN make