Category: Documentation

How to Setup Bash on Windows 10 for Developers – Ultimate Setup

Bash for Windows 10 has been out for almost a year now. It has been incredible for a developer like myself to be able to use Bash natively on a Windows machine! In this article, I’ll show you how I install my main Bash setup for Windows 10.   Requirements Your Windows 10 PC must be running a 64-bit version of Windows 10 Anniversary Update build 14393 or later. To find your PC’s CPU architecture and Windows version/build number, open...

More

nba_py documentation with examples

nba_py collects nba statistics from stats.nba.com. This page will provide documentation on the endpoints and example data that nba_py can get because nba stats api documentation is very minimal. nba_py also does have documentation, but it’s more about the parameters of functions that you can do without examples of what return data you may get. How to install nba_py Get pip git clone https://github.com/seemethere/nba_py cd nba_py sudo pip install . After you install nba_py, you can use the library by...

More

How to Copy to System Clipboard from Vim

In this tutorial, I used Cygwin on Windows 10 and Bash on Windows 10 to copy text from vim to the system clipboard for pasting. Check if we have +clipboard on our version of vim If you’re using bash on Windows or Ubuntu, and vim does not have +clipboard, sudo apt-get install vim-gnome -y +clipboard gets installed vim file Type: :%y+ to copy all lines Right click and paste, and you’ll see the lines you copied from vim   Check if we have +clipboard on...

More

How to Script Interactive Programs or TUIs on Python with pexpect

If I had a interactive program or shell like bash, how do I automate and script what I want to do with Python? There’s a useful pip module called pexpect that you can install. The idea of pexpect originated from a programming language called Expect that automates interactions with programs that expose a text terminal like ftp, ssh, etc. Think of any program that opens a session that you have to exit! Prerequisites Python 2.7 or Python 3.3 or above pip install pexpect If...

More

How to Get a User’s Email Address on Github

There are a lot of people (software engineers,  open source compatriots, coding warriors) who contribute to programming projects on Github. You may be interested in a certain someone on Github, and you need to contact them! Recruiters? Potential partners? This is the surest way to find someone’s email through Github! Find the person’s Github username. Go to a recent Github project that they’ve contributed. Check the link of a commit message. Add .patch to the link, and you’ll see the...

More

Largest Prime Factor

Project Euler is a website with a series of math problems that can be solved with programming. Problem 3 is about finding the largest prime factor of a number. Although my first impression is that the problem looks simple since I can iterate through the possibilities one by one and find the largest prime factor. The problem is that we’re finding the largest prime factor! The largest prime factor of a very large number can be as big as the...

More

How to Fix ^M Characters in Vim

I opened a CSV file in Microsoft Excel. I approved compatibility with macros on a Mac. Then, I opened the same CSV file with vim. The entire CSV file was reduced to a single line whenever I opened the file with vim. Something like this: Number of Sloths,Type^M15,black^M10,brown^M5,blue If we try to substitute all the ^M characters, those characters aren’t found! vim slothparadise.csv The characters are actually a little different. We use vim‘s substitution for \r. :%s/\r/\r/g All the ^M...

More

How to install Pip as a User

I don’t have root access on this Macintosh that I’m using. How am I supposed to get the pip package manager for Python? Python comes installed on every Macintosh. python –version Python 2.7.10 Step 1) Get easy_install easy_install is a Python utility for installing certain Python related packages. You might already have easy_install! To check: easy_install If you don’t have easy_install, you can install easy_install for the user. wget –no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O – | python – –user Installing easy_install script to /Users/…/Library/Python/2.7/bin...

More

C++ Libraries: Linking and Compiling

What is the -I, the -L, and the –(little L)? Why am I getting so many errors? What’s going on underneath? C and C++ libraries can be thought of as a conglomeration of functions and new keywords that you are able to use in your code. To truly understand what libraries are made of, we should first refresh on header and source files.   Header and Source File Example Header files contain declarations of functions and variables and often have...

More

Google Testing: Example and CMake Integration

The Google testing environment is frequently used in software engineering projects as a means of ensuring the functionality of your code. It is a framework that highlights the fundamentals of the iterative development work flow with the ability to confirm a set of tests as you are developing, thereby increasing the reliability of your final product and reducing time spent trouble shooting overall. The main tests that the framework allows for is assertions. An assertion simply checks to see if...

More