Things I tend to forget


Using MySQL + xargs to restore a Mydumper backup

Split the restore, first the schema, then the data:


dump# ls my_database.* | grep schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"
dump# ls my_database.* | grep -v schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"

Skip restoring data for a few tables:


dump# ls my_database.* | egrep -v 'tbl_a|tbl_b|tbl_c' | grep -v schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"

Reference: http://www.dctrwatson.com/2010/07/using-mydumper-to-parallel-dumpimport-fromto-mysql/

Similar Posts:




Update PIP on Ubuntu

From SO answer

Your pip may be outdated. Even in Ubuntu 14.04 LTS, the pip version it installed using apt-get install python-pip was 1.5.4. Try updating pip manually, and possibly the new packages again as well.

pip --version # 1.5.4
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
hash -r # reset bash cache
pip --version # 6.0.8

The hash -r line is essential!

reference: https://pip.pypa.io/en/latest/installing.html

Similar Posts:




Bind Solr 5.5 to localhost

Edit /opt/solr/bin/solr

Find the line with SOLR_START_OPTS and add the following after "-Djetty.port=$SOLR_PORT":
"-Djetty.host=localhost"

Mine looks like this:
SOLR_START_OPTS=('-server' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" \
"${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" \
"-Djetty.port=$SOLR_PORT" "-Djetty.host=localhost" "-DSTOP.PORT=$stop_port" "-DSTOP.KEY=$STOP_KEY" \
"${SOLR_HOST_ARG[@]}" "-Duser.timezone=$SOLR_TIMEZONE" \
"-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.install.dir=$SOLR_TIP" \
"${LOG4J_CONFIG[@]}" "${SOLR_OPTS[@]}")

Someone also suggested adding it to the SOLR_HOST_ARG array earlier in the same file. You can try that:
SOLR_HOST_ARG+=("-Djetty.host=$SOLR_HOST")

I hope it helps!

Similar Posts:




Brewing Beer vs Distilling Spirits

Compare Brewing Beer, Distilling Spirits, & Making Wine

original at http://www.brewhaus.com/Lets-Compare-Brewing-beer-vs-Distilling-Spirits.aspx

PS. I was actually looking for http://linuxbrew.sh/ 🙂

Similar Posts:

    None Found




WordPress Ajax Skeleton

Similar Posts:




Webmin/VirtualMin with Let’s Encrypt

Virtualmin team said the next version of Virtualmin/Webmin will automate most of the letsencrypt setup. Meanwhile there’s an ongoing conversation about it in the forums

My setup:
./letsencrypt-auto certonly --webroot --webroot-path /usr/share/nginx/html -d my.vmin.server

Then in Webmin > Webmin Configuration > SSL Encryption set:

  • Private key file to /etc/letsencrypt/live/my.vmin.server/privkey.pem
  • Certificate file to /etc/letsencrypt/live/my.vmin.server/fullchain.pem

Add a monthly crontab job to renew the certificate:
/usr/local/letsencrypt/letsencrypt-auto certonly \
--webroot --webroot-path /usr/share/nginx/html -d my.vmin.server \
--renew-by-default \
--agree-tos

Similar Posts:




Php5{en,dis}mod mcrypt

Seriously. I’m doing too much php stuff!

Here are a few things I learned in the last couple of days:

apt-get install php5-mcrypt
dpkg -l php5-mcrypt
ii php5-mcrypt 5.4.6-0ubuntu6 amd64 MCrypt module for php5
php -m | grep -c mcrypt
0
php5enmod mcrypt
php -m | grep mcrypt
mcrypt

And to install xhgui+xhprof, follow this tutorial (README is lacking)

Similar Posts:




Casarecce in Ricotta And dried tomato sauce

image

Similar Posts:

    None Found




Reminder to self: Don’t use == for string comparison in PHP

From SO thread

You should never use == for string comparison. === is OK.

$something = 0;
echo ('password123' == $something) ? 'true' : 'false';

Just run the above code and you’ll see why.

$something = 0;
echo ('password123' === $something) ? 'true' : 'false';

The reason is that when using ‘==’ it will try to convert the string to a number, and match it!

Now where’s the emoji for facepalm?

Similar Posts: