3D printed soldering iron holder

I recently bought 3D printer and I designed extra helping hand for soldering iron. 

I used tinkercad.com for design 3D modeling. 

Here is what I have designed. 

And printed this out using Anet A8 printer. 

And here are the parts printed out.

Assemble these together. 

It can hold solder rill and anything.

Like this.

It will be useful helper when I am making DIY projects.

Facebook Comments

Install HTTPS using Let’s Encrypt Certificates on multiple websites

Introduction

SSL certificates are used within server and client to encrypt the traffic. This gives extra security for users accessing the application. Let’s Encrypt is one of free certificates that easily installed on your web servers.
Here’s how to install multiple domains on single apache web server.

Step 1 – Configure vhost file.

We need to prepare apache vhost configuration for SSL.
Create new vhost file with different name.
For example, save to /etc/apache2/site-available/test.com-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@test.com
    DocumentRoot /websites/com_test_www/www
    ServerName test.com
    ErrorLog ${APACHE_LOG_DIR}/error-test.log
    CustomLog ${APACHE_LOG_DIR}/access-test.log combined
    Include /etc/letsencrypt/options-ssl-apache.conf
    ServerAlias test.com
    ServerAlias www.test.com
    SSLCertificateFile /etc/letsencrypt/live/test.com-0001/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/test.com-0001/privkey.pem
</VirtualHost>
</IfModule>
Step 2 – Install  Let’s Encrypt
sudo add-apt-repository ppa:certbot/certbot

sudo apt-get update

sudo apt-get install python-certbot-apache
Step 3 – Configure the Certificates
sudo certbot --apache -d test.com -d www.test.com

Here’s how to verify after installed new certificate.

https://www.ssllabs.com/ssltest/analyze.html?d=example.com&latest

To generate multiple certificates

sudo certbot --apache -d test2.com -d www.test2.com
Step 4 – Auto renewal using crontab

The new certificate will last 3 month but it’s good to renew automatically using cron job.

sudo crontab -e
30 1 * * * /usr/bin/certbot renew --quiet
Step 5 – Redirect http to https

Check if your websites opens fine with https:// , let’s make redirect http:// to https:// using vhost.

Open vhost file used for http.
For example, vi /etc/apache2/site-available/test.com.conf
And put below line:

Redirect permanent / https://test.com

Below is example:

<VirtualHost *:80>
    ServerAdmin webmaster@test.com
    DocumentRoot /websites/com_test_www/www
    ServerName test.com
    Redirect permanent / https://test.com
    ErrorLog ${APACHE_LOG_DIR}/error-test.log
    CustomLog ${APACHE_LOG_DIR}/access-test.log combined
</VirtualHost>

Test if your websites redirect http:// to https://

You may need to delete cookies on your browser for testing correctly.

Conclusion

It’s good to check the official Let’s Encrypt blog time to time for important updates.

Facebook Comments

Switch to HTTPS, Install free SSL Certificates using Let’s Encrypt

SSH, also known as Secure Socket Shell, is a network protocol that provides administrators with a secure way to access a remote computer. SSH also refers to the suite of utilities that implement the protocol. Secure Shell provides strong authentication and secure encrypted data communications between two computers connecting over an insecure network such as the Internet.

Without SSH, browser marked as “Not Secure”  on the address line in Chrome.  This is essential to have secure browsing.

If you have SSH access, use command line.

1. get cerbot

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-apache

2. Then install cerbot

$ sudo certbot --apache

3. Automating renewal for testing

sudo certbot renew --dry-run

4. Add below to crontab for auto renewal

43 6 * * * certbot renew --post-hook "systemctl reload nginx"

If you don’t have access to SSH then check control panel if there’s Let’s Encrypt option.

In my case,
1. After login plesk control panel, go to Let’s Encrypt.

Let's Encrypt

2. Then enable it.

Let's Encrypt

3. If your website is not redirecting to https automatically, go to host settings and setup redirect from HTTP to HTTPS.

Let's Encrypt

Facebook Comments

Change server timezone on Linux CentOS

Here’s way to change timezone on CentOS.

  1. Access to SSH through root account.
  2. Check timezone setting using date command.
  3. Check the timezone list using timedatectl list-timezonescommand.
  4. Change timezone, for example.
    timedatectl set-timezone America/New_York
  5. Check if that applied using date command again.
Facebook Comments

Install phpMyAdmin ubuntu via command line

phpMyAdmin is useful tool to check database content. And I would like to use it on my development server. It’s quite simple and straight forward steps.

You will need root privilege to install this and supposed to be mysql installed and configured already.

  1. First prepare apt-get up to date
    apt-get update && apt-get upgrade
  2. Install phpMyAdmin
    apt-get install phpmyadmin

    When you install and will see and option to choose a web server to choose. If you have apache2 installed, select the option. By default, it’s  blank and looks like chosen but actually need to press space key to select. Then press tab and click OK.

    phpmyadmin install choose apache2
    phpmyadmin install choose apache2

    Another option window is asking if I want to use dbconfig-common. If you already db configured, simply choose “No”.

    phpmyadmin install config

    It will ask password for phpmyadmin user if you choose dbconfig-common as Yes. Put desired password there.

  3. Now you can try access http://yourdomain.com/phpmyadmin

    phpmyadmin installed
    phpmyadmin installed
Facebook Comments

mysql allow remote access from any host

Granting mysql access from remote is not secure, so it’s not recommendable but sometimes we need to do it. Here’s how to do.

  1. Login to mysql with root and create user with remote connect.
    GRANT ALL PRIVILEGES ON remote_db.* TO 'remote_user'@'%' IDENTIFIED BY 'passwordhere';
    
    FLUSH PRIVILEGES;
  2. We need to allow remote connection from mysql configuration. mysql.cnf or mysqld.cnf files locations are differ but in my case, it is located in /etc/mysql/mysql.conf.d/ folder.
    vi /etc/mysql/mysql.conf.d/mysqld.cnf And comment out  below line.
    #bind-address = 127.0.0.1
    After that mysql restart desired.
    service mysql restart
  3.  Now if you have any firewall or network security, allow the port. In my case, I needed to allow 3306 port in AWS inbound rule.
  4. Try to connect from remote.

    mysql -u {username} -p -h {ip address}

    mysql remote connection
    mysql remote connection
Facebook Comments

Use HipChat PHP API

Hipchat is good communication platform not just between people but also between machine and apps.

I am using HipChat to monitor deployment in Jenkins. There’s HipChat plugin for Jenkins.

Hipchat Jenkins plugin
Hipchat Jenkins plugin

And I would like to get this deployment result using API.

hipchat log
hipchat log

Here we go.

First we need to install composer if it is not installed on the server.

sudo apt-get update
sudo apt-get install curl php-cli php-mbstring git unzip
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php

After get composer setup file, we can verify the installer. go to https://composer.github.io/pubkeys.html and get key.
Run this command after replace key.

php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

You will see the message like “Installer verified”. Then turn this.

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Next step is get HipChat PHP API and configure composer accordingly.

git clone https://github.com/vanilla/hipchat-api.git
curl -sS https://getcomposer.org/installer | php
php composer.phar install

When you git clone, the git repository has composer.json file and run curl -sS https://getcomposer.org/installer | php  will down load composer.phar file and all sub folders will be created after run php composer.phar install

Now we need to get API Token.  Login to HipChat and go to Profile > API access menu > create new token.

get hipchat api token
get hipchat api token

Finally, we can make example script.

<?php
// The library lives in the HipChat namespace.
use HipChat\v2\HipChatClient;

// Require composer's autoloader.
require_once 'vendor/autoload.php';
  
// Define the cli options.
$client = new HipChatClient();
$client->setAuth('{your api token put here}');

// Start making calls!
$options['max-results']=5;
$options['start-index']=0;
$message = $client->roomsAPI()->getHistory('{room number goes here}',$options);
print_r($message);

I got this chat history. Yay!

hipchat api result
hipchat api result

I put it on my Raspberry Pi LCD display to monitor quickly.

hipchat on my raspberry pi
hipchat on my raspberry pi

Facebook Comments

Software serial monitor on Attiny85

Attiny85 is cheap and tiny MCU and it’s useful for small project.

However, It’s difficult to monitor what’s going on inside of tiny chip.

Serial monitor is useful to check that out.

There’s many example to check this on the web, but some how the result showing up with reversed question mark.

Finally I found out that we can specify type of serial data read.

attiny85 serial monitor (TX)
attiny85 serial monitor (TX)

attiny85 serial monitor (RX)
attiny85 serial monitor (RX)

Facebook Comments

Google Structured data testing tool

Google algorithm changed and it’s checking structured data with schema.

Here’s brief instruction for making news page structured.

The Google structured data testing tool is available from here.

It is look like this.

google structured data testing tool

  1. First need to put NewsArticle schema in the html tag.
    <html itemscope itemtype="http://schema.org/NewsArticle" lang="en">
  2. Adding meta tags in the head tag (thumbnailUrl, mainEntityOfPage, description, articleSection)
    <meta name="news_keywords" content="Facebook,Facebook Today In,Facebook local news,Facebook testing Today In,Facebook fake news,Facebook Journalism Project" /><meta
    property="article:published_time" content="2018-01-11T23:01:57-05:00" /><meta
    property="article:modified_time" content="2018-01-11T23:01:56-05:00" /><meta
    itemprop="thumbnailUrl" content="http://image.techtimes.com/data/images/full/319769/facebook.jpg" />
    <meta itemprop="mainEntityOfPage" content="http://www.techtimes.com/articles/218601/20180111/facebook-is-testing-a-new-today-in-feature-to-bring-you-vetted-local-news.htm">
    <meta itemprop="description" content="Facebook is currently experimenting with a new city-based section called Today In. In it, users will be able to see local information, announcements, and news."/>
    <meta itemprop="articleSection" content="Society"/>
  3. Updated time (dateModified, datePublished) and author on the published date and reporter name
    <meta itemprop="datePublished" content="2018-01-12T08:37:24-05:00"/>
    <time class="time-format" itemprop="dateModified" datetime="2018-01-12T08:37:24-05:00" data-timestamp="1515764244">12 January 2018, 8:37 am EST</time>
    <span class="t1" itemscope itemtype="http://schema.org/Person" itemprop="author"> By <a href="/reporters/erik-pineda" itemprop="url"><em itemprop="name">Erik Pineda</em></a> Tech Times</span>
  4. Adding name and headline on the article title
    <h1 itemprop="name headline">Google Compiles List Of Chromebooks Vulnerable To Meltdown: Here&#039;s What You Need To Know</h1>
  5. Adding image in the image box
    <figure itemscope itemprop="image" itemtype="http://schema.org/ImageObject">
      <meta itemprop="url" content="http://image.techtimes.com/data/images/full/319798/google-chromebooks.jpg">
      <meta itemprop="width" content="804">
      <meta itemprop="height" content="420">
    </figure>
  6. Adding publisher, logo
    <div class="container" itemscope itemtype="http://schema.org/Organization" itemprop="publisher">
      <meta itemprop="name" content="Tech Times">
      <div class="logo" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
        <meta itemprop="url" content="http://asset.techtimes.com/static/common/_v0.0.1/images/logo.png">
        <meta itemprop="width" content="410">
        <meta itemprop="height" content="44">  
      </div>  
    </div>
  7. Adding Article body
    <div class="at-body" itemprop="articleBody">
      Article body text goes here
    </div>

    This is just an example, and checkout and testing more with the google structured data tool.

Facebook Comments

Mysql root password reset on Ubuntu

Stop mysql service

sudo /etc/init.d/mysql stop

Start without password

sudo mysqld_safe --skip-grant-tables &

Connect to Mysql

mysql -uroot

Reset password

use mysql;

update user set password=PASSWORD("passwordgoeeshere") where User='root';

flush privileges;

quit

Restart mysql

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
Facebook Comments