Automatically fill in verification code in course selection system login page

Verification code is broadly used in different websites to ensure the contents are only accessible by humans instead of bots. The course selection system in my college has also been added a verification code field in the login page to reduce momentary load of its server. (by slowing down everyone’s time to fill in the code and hit log in)

Besides that, the system was kindly designed a “Play Audio” button as well for visually impaired people to “hear” the verification code. However, there is a defect that we can take advantage of the “Play Audio” button function to fill in the verification code programmatically for us.

Since I have done my last course selection in my college life, I will demonstrate how to fill in the verification code by exploiting the “Play Audio” button function in below.


Keep Reading

Using FFmpeg concatenate multiple videos

Some cameras split a sigle video into multiple files during recoding due to the limit of the maximum file size in the file system(e.g. maximum single file size for FAT32 is 4GB).

Therefore, we will take advantage of FFmpeg to merge back our video fragments into a continued single video.

 

First, we put all our video fragments into the same folder, and create another file called clips.txt.

We add the names of the files into clips.txt in order which we want to concatenate.

Below is an example of the file format.

file 'first.mp4'
file 'second.mp4'
...

Last, run the following command will produce the concatenated video named output.mp4.

ffmpeg -f concat -i clips.txt -c copy output.mp4

[Matplotlib] Multiple axes with different scales

It’s quite often we will output the chart of the records that a neural network have played during training a neural network playing games.

As the records grows, the chart becomes crowded and is difficult to see how the line graph grows.

Therefore, we come up with a strategy that we only plot out the average of each 250 records in our chart.

Keep Reading

Docker Compose File (TensorFlow)

TensorFlow has supported Docker containers that could save the time from installing lots of stuffs on our operating system and messing around.

Besides typing in long Docker Command each time in the terminal for launching the container, using Docker Compose file is another option.

Create a new file called TensorFlow.yml and paste everything below into that file.

Freely to change the path in volumes in accordance with our computer’s path.

 

version: '3.1'

services:

	TernsorFlow:
		container_name: TensorFlow
		image: tensorflow/tensorflow:latest-py3
		restart: unless-stopped
		network_mode: "bridge"
		ports:
			- 6006:6006
		tty: true
		command: /bin/bash
		volumes:
			- /Users/AndyWu/Documents/Docker/TensorFlow:/TensorFlow

 
To create and start a new TensorFlow container from docker compose file, run the command.

docker-compose -f TensorFlow.yml up -d

Now our newly created container should start running.

Execute the bash shell in the container and interact with the pseudo-TTY by providing the options-it.

docker exec -it TensorFlow bash

We are now able to run our TensorFlow files with python in the container.

Git rename local and remote branches

I have created a new branch which was mainly to test some new functions written in other programming language several weeks ago.

Because the branch was for developing purpose, I didn’t put much effort in naming it.

In recent days, I was reviewing the repository and found that the name of that branch didn’t quite fit its purpose.

So I googled a bit how to rename local branches and remote branches.

 

Renaming Local Branches

git branch -m {the branch intended to rename} {new branch name}

This command should rename a local branch.

After that, we should push our modification to the server and remove the branch with old name from the server.

git push origin {new branch name} :{the branch to remove}

 

Rename Remote Branches

If the branch we would like to rename doesn’t exist in our computer but on the server, we should duplicate it and give the copy a desired name.

git branch {new branch name} origin/{the branch intended to rename}

Push our modification to the server. And the new branch with the desired name should appear in the repository.

git push origin {new branch name}

Since the old branch is redundant, remove it from the server.

git push origin :{the branch to remove}

 

Well done. The branches are renamed into the desire names.

  • 1
  • 2