Archive for the How To Category

2-Stroke Bike Engine Kit

| May 8th, 2018

Installing Your 2-Stroke Bike Engine Kit

Here we’ll instruct you on how to install a two-stroke bicycle engine kit on a bike. Now, before we even start, it’s important to know what you’re getting into and what you need to make sure installation goes as smooth as possible.

First things first- The Bike:

Even though the engine kit is made to be as universal as possible a few key features your bike should have will make installation a lot easier:

  • Your bike needs to be a standard male beach cruiser, road or hardtail mountain bike.
  • The tubes should be 25 to 28mm in diameter with an open “V” style frame
  • The frame should also have 9-11 inch of clearance between the bottom bracket and top bar.
  • These kits will fit most 26”x 1.75” wheel with a standard 12 or 14 gauge 36 count spoke
  • If you’re in these right specifications then you’re good to go!


Sprocket and Wheel Clamp Assembly:
install-2Most sprocket clamp assemblies comes with 9 bolts and nuts, two rubber grommets, and a single pair of metal plates (though some engine kits may have two). Most clamp assemblies come with 10mm bolts and studs, so you’ll need a socket wrench to complete this part of the installation.

If you’re using a coaster brake, first start by removing the coaster brake arm
(be careful not to accidentally disassemble the entire axle).

  • Cut a straight line in between two of the holes on one of grommets (not both)
  • Thread the grommet through the wheel around the hub (Note: Make sure the grommet holes are between the spokes, not blocking them)
  • Take the metal plates from your assembly and align them on top of the grommet inside of the wheel, then align the sprocket with the grommets to make sure the spokes and grommet holes are aligned
  • Starting from the inside of the wheel, send each bolt through the grommet and sprocket, and torque them down (Note: It will help to torque them in a star-shaped pattern)

Once you’re done tightening down the sprocket and clamp assembly, put the wheel on the bike and bolt it down with good tension on the bicycle chain.

Note: We highly recommend using caliper or disc brakes even if you have a coaster brake wheel. Because of the speeds you’ll be getting up to, you’ll want to be sure to have additional stopping power than a coaster brake.

Mounting the Engine:

Mounting the engine is actually a pretty easy procedure, but if your frame’s not as described above, there are a few things you’re going to need to install before mount the motor.
If you’re using a universal u-mount and/or vibration motor mounts to compensate for a larger downtube and/or seat tube, you’ll first need to remove the motor mount studs in your engine. Some riders use a stud extractor, but there’s an easy way to get those particular studs out: the two bolt method.

  • Thread a nut on to one of the studs, then thread another nut above the first
  • Tighten the nuts down as tight as possible between the two
  • Torque the bottom nut, and eventually you’ll be able to remove the studs.

To install the u-mount:

  • Remove your front motor mount and motor mount bracket
  • Place the mount plate on to the engine over the empty motor mount stud ports
  • Mount the two standing bolts in to the motor mount stud ports

To install vibration motor mounts:

  • Remove your motor mounts and motor mount brackets
  • Use the studs that came with the new mounts to fill in the motor mount stud ports
  • Slide the original motor mount back on to the studs, then the vibration motor mount on top of that

When those parts are installed, you can install the motor mount stud nuts. Once everything is ready to mount, then mount the engine on to your bike

Installing Your Clutch:

The parts of your clutch (for installation purposes) are your clutch cable, clutch lever, clutch spring, and the heat shield spring.

  • Take your stock handle bar grips off the handle bars, and slip on the clutch lever
  • Install the clutch cable in to the clutch lever (the beaded end should go in to the lever socket- just like installing a brake cable), then tighten it down
  • Slide the heat shield spring over the opposite end of the cable, and slide the wire though the clutch base screw
  • Slide the clutch spring over the wire, then slide the wire through the clutch arm on the engine (Note: loosen the clutch arm screw before sending the wire through the clutch arm)
  • Align the clutch arm so it’s flush with the engine (i.e. it points straight back), tighten the tension of the clutch cable so it stays, then tighten down the clutch arm screw

With your clutch arm pulled in, you can pedal your bike like normal because the engine’s disengaged. Once you release the clutch lever, your engine will engage.

Chain Installation:
For easier installation of the chain, start by removing the clutch case cover (along with the clutch plate) and the drive sprocket case cover. Doing this will help the drive sprocket and clutch spin with ease. Then remove the master link from your chain

  • Measure the chain on the rear and front sprockets, then remove any unnecessary links (you’ll need a motorcycle chain breaker to remove links). Note: you’ll want to leave .5” of slack on the chain so that it doesn’t snap
  • Reinstall the master link
  • Reinstall the case covers and components
  • Install the pulley on your rear fork, and put the bottom portion of the chain on top of the plastic idle wheel
  • Align the chain so that the top and bottom portions of the chain run along a straight path. If the chain is not straight it can slip off the sprockets and damage your spokes (and even you, if you’re not careful)


Throttle Installation:
Start by dry fitting the throttle handle and kill switch on your handle bars, then mark where you’ll need to drill a ¼” hole in to the handle bar.

  • Thread the “L” bracket end of the throttle cable in to your kill switch housing
  • Slide the beaded end of the cable in to the cable port in the throttle grip
  • Insert the grip in to the kill switch housing, then slip the grip on to the handle bars
  • Line the pin from the top of the kill switch to the port you drilled, then screw the top and bottom portions of the kill switch together, forming your throttle and kill switch assembly

Carburetor Installation:

Start by going to the carburetor and removing the bottom end of the carburetor and remove the screw top, spring, plunger, jet needle (with c-clip attached), and the “e” washer.

  • Start by now inserting the jet needle in to the plunger, then the “e” clip above that
  • Stand the spring up in the plunger, then press down the screw top down on to the spring, which will compress the throttle components
  • Thread the end of the throttle cable through the screw top, and in to the plunger
  • Send the beaded end of the throttle cable in to the small port of the plunger (not the jet needle port), install, and let it go
  • Insert your new throttle assembly back in to your carburetor. Note: Do not force the plunger in to the carburetor. If it does not easily slide in, this is a sign that it’s not aligned within the carburetor. Slowly turn the cable until you feel the plunger easily drop down in to the carb
  • Screw the screw top back on
  • Loosen carburetor mounting clamps, slide the carburetor over the manifold, tighten it around the manifold, and align the carburetor so that the throttle cable is pointed up and the float bowl is level with the ground

Electrical Wiring

There are four components to your electric wiring: the magneto, the CDI, kill switch, and the spark plug. The spark plug, magneto, and now the kill switch are already installed, so all you need to install in the CDI. You can mount the CDI anywhere on your frame, as long as it’s close enough to the spark plug to connect to it.

Now that everything is ready to wire, let’s get down to it:

  • Connect the black wire from the CDI to the black wire from the magneto, and the green wire from the kill switch. These are your ground wires that will complete the circuit
  • Connect the blue wire from the CDI to the blue wire on the magneto, and the yellow/red wire from the kill switch

Note: kill switch wiring coloring will vary between engines and engine suppliers. These colors may not be your colors, but as long as you know which ground wires you have it’s only a process of elimination where your other wires are.

The Rest of Your Bike:

Now it’s time to install the rest of those components.

  • Install the muffler on to the front of the motor head (opposite of the carburetor)
  • Install the gas tank
    • Line the tank up with the top bar, align the gas tank brackets under that bar, and fasten the tank to the bike
    • Install the fuel valve in to the gas tank, connect the fuel line to the carburetor’s fuel jet, and connect the fuel line to the fuel valve
  • To install the chain guard, slide the guard’s front bolt port over the long screw behind your drive sprocket case cover, then fasten it with a nut. Then use a zip-tie to fasten the other end to the frame (Do not let this interfere with the chain)

CONGRATULATIONS- You just installed your bike engine kit! Before riding, we recommend using a ratio of 6 oz to 1 gallon to break your motor in, then 4-5oz to 1 gallon after the motor is broken in. However, engines may vary, so consult the manufacturer for their recommended oil ratios.

Git Cheat Sheet

| December 29th, 2017

Git is the open source distributed version control system that facilitates GitHub activities on your laptop or
desktop. This cheat sheet summarizes commonly used Git command line instructions for quick reference.


Review edits and craft a commit transaction
[syntax type=”html|php|js|css”]$ git status[/syntax]
Lists all new or modified files to be committed
[syntax type=”html|php|js|css”]$ git add [file][/syntax]
Snapshots the file in preparation for versioning
[syntax type=”html|php|js|css”]$ git reset [file][/syntax]
Unstaged the file, but preserve its contents
[syntax type=”html|php|js|css”]$ git diff[/syntax]
Shows file differences not yet staged
[syntax type=”html|php|js|css”]$ git diff –staged[/syntax]
Shows file differences between staging and the last file version
[syntax type=”html|php|js|css”]$ git commit -m “[descriptive message]”[/syntax]
Records file snapshots permanently in version history


Configure user information for all local repositories
[syntax type=”html|php|js|css”]$ git config –global “[name]”[/syntax]
Sets the name you want atached to your commit transactions
[syntax type=”html|php|js|css”]$ git config –global “[email address]”[/syntax]
Sets the email you want atached to your commit transactions
[syntax type=”html|php|js|css”]$ git config –global color.ui auto[/syntax]
Enables helpful colorization of command line output


Start a new repository or obtain one from an existing URL
[syntax type=”html|php|js|css”]$ git init [project-name][/syntax]
Creates a new local repository with the specified name
[syntax type=”html|php|js|css”]$ git clone [url][/syntax]
Downloads a project and its entire version history


Name a series of commits and combine completed efforts
[syntax type=”html|php|js|css”]$ git branch[/syntax]
Lists all local branches in the current repository
[syntax type=”html|php|js|css”]$ git branch [branch-name][/syntax]
Creates a new branch
[syntax type=”html|php|js|css”]$ git checkout [branch-name][/syntax]
Switches to the specified branch and updates the working directory
[syntax type=”html|php|js|css”]$ git merge [branch][/syntax]
Combines the specified branch’s history into the current branch
[syntax type=”html|php|js|css”]$ git branch -d [branch-name][/syntax]
Deletes the specified branch


Register a repository bookmark and exchange version history
[syntax type=”html|php|js|css”]$ git fetch [bookmark][/syntax]
Downloads all history from the repository bookmark
[syntax type=”html|php|js|css”]$ git merge [bookmark]/[branch][/syntax]
Combines bookmark’s branch into current local branch
[syntax type=”html|php|js|css”]$ git push [alias] [branch][/syntax]
Uploads all local branch commits to GitHub
[syntax type=”html|php|js|css”]$ git pull[/syntax]
Downloads bookmark history and incorporate changes


Relocate and remove versioned files
[syntax type=”html|php|js|css”]$ git rm [file][/syntax]
Deletes the file from the working directory and stages the deletion
[syntax type=”html|php|js|css”]$ git rm –cached [file][/syntax]
Removes the file from version control but preserves the file locally
[syntax type=”html|php|js|css”]$ git mv [file-original] [file-renamed][/syntax]
Changes the file name and prepares it for commit


Shelve and restore incomplete changes
[syntax type=”html|php|js|css”]$ git stash[/syntax]
Temporarily stores all modified tracked files
[syntax type=”html|php|js|css”]$ git stash list[/syntax]
Lists all stashed changesets
[syntax type=”html|php|js|css”]$ git stash pop[/syntax]
Restores the most recently stashed files
[syntax type=”html|php|js|css”]$ git stash drop[/syntax]
Discards the most recently stashed changeset


Erase mistakes and craft replacement history
[syntax type=”html|php|js|css”]$ git reset [commit][/syntax]
Undoes all commits afer [commit], preserving changes locally
[syntax type=”html|php|js|css”]$ git reset –hard [commit][/syntax]
Discards all history and changes back to the specified commit


Browse and inspect the evolution of project files
[syntax type=”html|php|js|css”]$ git log[/syntax]
Lists version history for the current branch
[syntax type=”html|php|js|css”]$ git log –follow [file][/syntax]
Lists version history for a file, including renames
[syntax type=”html|php|js|css”]$ git diff [first-branch]…[second-branch][/syntax]
Shows content differences between two branches
[syntax type=”html|php|js|css”]$ git show [commit][/syntax]
Outputs metadata and content changes of the specified commit


Exclude temporary files and paths

[syntax type=”html|php|js|css”]$ git ls-files –other –ignored –exclude-standard[/syntax]

Lists all ignored files in this project
[syntax type=”html|php|js|css”]*.log
A text file named .gitignore suppresses accidental versioning of
files and paths matching the specified patterns


Case 1: Don’t care about local changes

  • Solution 1: Get the latest code and reset the code
    git fetch origin
    git reset --hard origin/[tag/branch/commit-id usually: master]
  • Solution 2: Delete the folder and clone again :D
    rm -rf [project_folder]
    git clone [remote_repo]

Case 2: Care about local changes

  • Solution 1: no conflicts with new-online version
    git fetch origin
    git status

    will report something like:

    Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.

    Then get the latest version

    git pull
  • Solution 2: conflicts with new-online version
    git fetch origin
    git status

    will report something like:

    error: Your local changes to the following files would be overwritten by merge:
    Please, commit your changes or stash them before you can merge.

    Commit your local changes

    git add .
    git commit -m ‘Commit msg’

    Try to get the changes (will fail)

    git pull

    will report something like:

    Pull is not possible because you have unmerged files.
    Please, fix them up in the work tree, and then use 'git add/rm <file>'
    as appropriate to mark resolution, or use 'git commit -a'.

    Open the conflict file and fix the conflict. Then:

    git add .
    git commit -m ‘Fix conflicts’
    git pull

    will report something like:

    Already up-to-date.


More info:

How do I use ‘git reset –hard HEAD’ to revert to a previous commit?

How can I get latest updates without committing my code(have conflicts)?
Interesting question. I've never tried this before but you may try it and report back ;) so:
- Make a patch with the changes: git diff > uncommitted-changes.patch
- Reset the branch
- pull the changes
- apply the patch


Protected: GCP Cheat Sheet

| December 27th, 2017

This content is password protected. To view it please enter your password below:

Docker Cheat Sheet

| December 1st, 2017

Docker & Docker Compose Overview

Quick List

  • docker-compose build
  • docker-compose up -d
  • docker-compose logs -f
  • docker exec -it <container> bash
  • docker run -it centos
  • docker ps -aq --no-trunc | xargs docker rm
  • docker images -q --filter dangling=true | xargs docker rmi

NOTE: Configure Direct-LVM Mode for Production


Can’t connect to your Container?  It Exists immediately and  you want to see why?

# docker commit <container-id> my-hosed-container &&
# docker run -it my-hosed-container /bin/sh

Push images to your Registry (GCP)

# gcloud docker -- push

List gcloud container Images

# gcloud container images list 


# gcloud container images list-tags
244bf0d4ffc6 dev  2017-12-01T15:44:01

Remove images from Registry (GCP)

# gcloud container images delete
  Associated tags:
 - dev
This operation will delete the tags and images identified by the 
digests above.

Do you want to continue (Y/n)?  y

Deleted [].
Deleted [].

Pull images from Registry (GCP)

# gcloud docker -- pull

To pull a specific image, append the image’s tag or digest:

# gcloud docker -- pull
# gcloud docker -- pull

Docker Swarm Init

# docker swarm init --advertise-addr

Swarm initialized: current node (3ww6m5jr6df24sgg0hj8i1d7) is now a manager.

To add a worker to this swarm, run the following command:

# docker swarm join \
--token SWMTKN-1-1ygehettvmj02Fakeasd4thedfFake8aql26o7jd9u8h6oFakej5u-1f01w77gxtanFakezmnck3jve \

To add a manager to this swarm, run docker swarm join-token manager and follow the instructions.

Docker Lifecycle Commands

Starting and Stopping Docker

Removing Docker containers and images

Playing with Docker can leave you with several stopped containers and unneeded, intermediary images. This may waste substantial disk space. This article shows how to efficiently remove such containers and images.

List all exited containers

# docker ps -aq -f status=exited

Remove stopped containers

# docker ps -aq --no-trunc | xargs docker rm

This command will not remove running containers, only an error message will be printed out for each of them.

Remove containers

# docker rm $(docker ps -qa --no-trunc --filter "status=exited")

Removing Unused Volumes

# docker volume rm $(docker volume ls -qf dangling=true
# docker volume ls -qf dangling=true | xargs -r docker volume rm

Removing Networks

# docker network ls
# docker network ls | grep "bridge"
# docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')

Remove dangling/untagged images

# docker images -q --filter dangling=true | xargs docker rmi

Remove containers created after a specific container

# docker ps --since a1bz3768ez7g -q | xargs docker rm

Remove containers created before a specific container

# docker ps --before a1bz3768ez7g -q | xargs docker rm

Use --rm for docker build

Use --rm together with docker build to remove intermediary images during the build process.

Searching for Images in the Docker Hub

You can search for images available on Docker Hub by using the docker command with the searchsubcommand. For example, to search for the CentOS image, type:

docker search centos

The script will crawl Docker Hub and return a listing of all images whose name match the search string. In this case, the output will be similar to this:

NAME                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                          The official build of CentOS.                   2224      [OK]       
jdeathe/centos-ssh              CentOS-6 6.7 x86_64 / CentOS-7 7.2.1511 x8...   22                   [OK]
jdeathe/centos-ssh-apache-php   CentOS-6 6.7 x86_64 / Apache / PHP / PHP M...   17                   [OK]
million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   11                   [OK]
nimmis/java-centos              This is docker images of CentOS 7 with dif...   10                   [OK]
torusware/speedus-centos        Always updated official CentOS docker imag...   8                    [OK]
nickistre/centos-lamp           LAMP on centos setup                            3                    [OK]


In the OFFICIAL column, OK indicates an image built and supported by the company behind the project. Once you’ve identifed the image that you would like to use, you can download it to your computer using the pull subcommand, like so:

docker pull centos

After an image has been downloaded, you may then run a container using the downloaded image with the run subcommand. If an image has not been downloaded when docker is executed with the runsubcommand, the Docker client will first download the image, then run a container using it:

  • docker run centos

To see the images that have been downloaded to your computer, type:

  • docker images

The output should look similar to the following:

[secondary_lable Output]
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              778a53015523        5 weeks ago         196.7 MB
hello-world         latest              94df4f0ce8a4        2 weeks ago         967 B

As you’ll see later in this tutorial, images that you use to run containers can be modified and used to generate new images, which may then be uploaded (pushed is the technical term) to Docker Hub or other Docker registries.

Running a Docker Container

The hello-world container you ran in the previous step is an example of a container that runs and exits, after emitting a test message. Containers, however, can be much more useful than that, and they can be interactive. After all, they are similar to virtual machines, only more resource-friendly.

As an example, let’s run a container using the latest image of CentOS. The combination of the -i and -t switches gives you interactive shell access into the container:

  • docker run -it centos

Your command prompt should change to reflect the fact that you’re now working inside the container and should take this form:

[root@59839a1b7de2 /]#

Important: Note the container id in the command prompt. In the above example, it is 59839a1b7de2.

Now you may run any command inside the container. For example, let’s install MariaDB server in the running container. No need to prefix any command with sudo, because you’re operating inside the container with root privileges:

  • yum install mariadb-server

Committing Changes in a Container to a Docker Image

When you start up a Docker image, you can create, modify, and delete files just like you can with a virtual machine. The changes that you make will only apply to that container. You can start and stop it, but once you destroy it with the docker rm command, the changes will be lost for good.

This section shows you how to save the state of a container as a new Docker image.

After installing MariaDB server inside the CentOS container, you now have a container running off an image, but the container is different from the image you used to create it.

To save the state of the container as a new image, first exit from it:

  • exit

Then commit the changes to a new Docker image instance using the following command. The -m switch is for the commit message that helps you and others know what changes you made, while -a is used to specify the author. The container ID is the one you noted earlier in the tutorial when you started the interactive docker session. Unless you created additional repositories on Docker Hub, the repository is usually your Docker Hub username:

  • docker commit -m “What did you do to the image” -a “Author Name” container-id repository/new_image_name

For example:

  • docker commit -m “added mariadb-server” -a “Sunday Ogwu-Chinuwa” 59839a1b7de2 finid/centos-mariadb

Note: When you commit an image, the new image is saved locally, that is, on your computer. Later in this tutorial, you’ll learn how to push an image to a Docker registry like Docker Hub so that it may be assessed and used by you and others.

After that operation has completed, listing the Docker images now on your computer should show the new image, as well as the old one that it was derived from:

  • docker images

The output should be of this sort:

REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
finid/centos-mariadb   latest              23390430ec73        6 seconds ago       424.6 MB
centos                 latest              778a53015523        5 weeks ago         196.7 MB
hello-world            latest              94df4f0ce8a4        2 weeks ago         967 B

In the above example, centos-mariadb is the new image, which was derived from the existing CentOS image from Docker Hub. The size difference reflects the changes that were made. And in this example, the change was that MariaDB server was installed. So next time you need to run a container using CentOS with MariaDB server pre-installed, you can just use the new image. Images may also be built from what’s called a Dockerfile. But that’s a very involved process that’s well outside the scope of this article. We’ll explore that in a future article.

Listing Docker Containers

After using Docker for a while, you’ll have many active (running) and inactive containers on your computer. To view the active ones, use:

  • docker ps

You will see output similar to the following:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
f7c79cc556dd        centos              "/bin/bash"         3 hours ago         Up 3 hours                              silly_spence

To view all containers — active and inactive, pass it the -a switch:

  • docker ps -a

To view the latest container you created, pass it the -l switch:

  • docker ps -l

Stopping a running or active container is as simple as typing:

  • docker stop container-id

The container-id can be found in the output from the docker ps command.

Pushing Docker Images to a Docker Repository

The next logical step after creating a new image from an existing image is to share it with a select few of your friends, the whole world on Docker Hub, or other Docker registry that you have access to. To push an image to Docker Hub or any other Docker registry, you must have an account there.

This section shows you how to push a Docker image to Docker Hub.

To create an account on Docker Hub, register at Docker Hub. Afterwards, to push your image, first log into Docker Hub. You’ll be prompted to authenticate:

  • docker login -u docker-registry-username

If you specified the correct password, authentication should succeed. Then you may push your own image using:

  • docker push docker-registry-username/docker-image-name

It will take sometime to complete, and when completed, the output will be of this sort:

The push refers to a repository []
670194edfaf5: Pushed 
5f70bf18a086: Mounted from library/centos 
6a6c96337be1: Mounted from library/centos


After pushing an image to a registry, it should be listed on your account’s dashboard.

If a push attempt results in an error of this sort, then you likely did not log in first:

The push refers to a repository []
e3fbbfb44187: Preparing
5f70bf18a086: Preparing
a3b5c80a4eba: Preparing
7f18b442972b: Preparing
3ce512daaf78: Preparing
7aae4540b42d: Waiting
unauthorized: authentication required

Log in, then repeat the push attempt.

$ curl

$ dig +short

$ curl -s | grep -o "[[:digit:].]\+"

$ curl -s | sed 's/[a-zA-Z<>/ :]//g'