Quick Edits Using VS Code

I’ve been working in Visual Studio pretty heavily in the last two weeks, but every once in a while I need to make quick edits to my .gitignore file, which isn’t in my project directory.

I usually open up a small text editor right from PowerShell and now that VS Code is out I thought ‘why not use that?’

Here’s how you can easily open files using code from PowerShell in three steps:

1.Find the path to VS Code
2. Edit your PowerShell profile
3. Open Files!

1. Find the VS Code Path

First thing we need to do is find where VS Code is in our directory.

If you have Code pinned to your start menu or on your desktop simply right click the icon and ‘select open file location’.

File explorer should now open to the location of the .exe.
Right click the Code.exe file and select ‘properties’.

If you selected a Shortcut Icon you should see a screen like this:


If you navigated to the actual location in directory of VS Code it should look like this:


Now right click and copy the path.

In my case: C:\Users\tireilly\AppData\Local\Code\app-0.1.0

2. Edit our PowerShell profile

To edit our profile we need to find the Microsoft.PowerShell_profile.ps1 file.

My file is located here:


I open the file in notepad to make my edits:


Now that we have our profile open we’ll create an alias for labeled code followed by the path to our .exe
eg: Set-Alias code ‘C:\Users\user\AppData\Local\Code\app-0.1.0\Code.exe

noticed how I added the Code.exe to the path so the program will launch!

Here’s a photo of my current PowerShell profile for reference:


Now we can save and close this file and open a new PowerShell window!

3. Edit some files!

Let’s edit our PowerShell profile with Code this time!


Something oddly satisfying about getting exactly what you want with words.


And there we go. The brand new Code editor at your fingertips whenever you need it!

Let me know if you have any comment or questions!

Amazing Dude
Professor Chang Yun is an excellent man with an amazing imagine cup record. His mentorship has led teams to US finals for 8 years straight. With 6 teams making it into the World Finals.

GitHub’s Gitignore and Keeping DB Keys Safe

I’m working with a raspberry pi and I’m learning how to collect and manage sensor data.

There is a lot of data and that’s awesome, but dealing with remote persistent storage has helped me understand some good ways of keeping stuff organized and safe.

For example: ‘Keys’ or ‘Tokens’ (Not to be confused with the Late English writer Tolkien)

These are the keys to the door of your data.
To access the contents behind these doors, you must establish that you are the key-holder. One of the ways to do this in software is to create a long complicated string that can passed to the database so you can input or output data.

As long as you keep this token secret nobody will be able to mess with your data, or use it without having to pay for it.

Now this sounds pretty simple, but what if you use that token in code that is stored in a public repository on GitHub? This is essentially like printing a bunch of keys to your house and leaving them all over town. Not safe or smart.


1. We need to keep these keys separate from the rest of your code.
2. We need to keep the file that contains those keys away from your public repository.

To do this I created a separate file called tokens.py that contains the strings of my tokens and a function called getStorageKey() that returns those strings.
Cool, we’ve satisfied our first goal.

Now we need to keep this file away from our repository. To do this we create a .gitignore file. This is a special ‘git’ file that allows us to specify which files will not be added to the remote repository.
To create a .gitignore file simply enter:

touch .gitignore

touch is a Unix command to create a file and update the access data, but not make any edits. Its the same as opening and closing without saving any changes.

After you’ve created this file you can edit it with any editor you like. I do it with sublime or VS Code because it helps me keep track of the separation occurring between visual studio and GitHub.

All you need to do is add on a separate lines the files you don’t want GitHub or just git to include.

When I first started all my .gitignore file had was:


Its expanded to include…


# the asterisk* acts as a wild card and will match any files with .pyc at the end
# anything that starts with a # is a comment and will be ignored from .gitignore

I saved this file (.gitignore) then added and committed it to the repository.

Now any files I add that end in .pyc or match tokens.py will not be added to my repository. And you will not be prompted to add them when you check git status.

What about files we’ve already have added???

If we add the rule after we added the file we want to ignore… We need to remove it from tracking on GitHub using the rm –cache command.

This will not remove it from your computer, but it will stop if from being tracked by GitHub, and will essentially be treated as if it was removed from your repository.

To pull this off simply type this command

git rm --cached filename.py

In this case I’m removing a file named ‘filename.py’.
After checking our git status we’ll see that this file is going to be removed.

Commit the changes and push to your remote repo.

You’ll see the files are still in your local directory, but are no longer in the remote or local repository. Hooray for keeping things safe!

Please let me know if you have any questions or comments.
The documentation is excellent and I recommend you spend some time reading through the resources below to round out your learning:

touch (Unix)
GitHub .gitignore
If you enter: ‘git ignore –help’ in your gitshell you can find more helpful documentation about using .gitignore
Setting up Code for Powershell
Setting up sublime for Powershell

Evangelists in their natural habitat. Behind a booth and with a computer.

WordPress – Adding Analytics

Site tracking is cool because information is cool!
This tutorial will show you how to configure analytics for a WordPress blog by editing the Header.php file using FTP.

Let’s imagine your company gave you something like this to begin analytics:

<meta name="t_omni_extblogid" content="contosotextblogs" />
<meta name="t_omni_blogname" content="alias" />
<meta name="t_omni_market" content="US" />
<meta name="t_omni_audience" content="DEVELOPER" />
<script type="text/javascript" src="http://www.contoso.com/feeds/omni_external_blogs.js"></script>
<noscript><a href='http://www.omnicron.com' title='Web Analytics'><img src='http://something.fancy.com'  height='1' width='1' border='0' alt='' /></a></noscript>

The only thing you should have to change is the “alias” to your personal alias.

Of course I’ve edited this snippet because we don’t won’t everybody to add analytics to their blog…

Okay, so you have your snippet. Where do you put it?

Let’s say your hosting your WordPress blog on Azure. You have a number of different ways to access these files.

The simplest is probably using an FTP client such as WinScp. An FTP client will allow you to change files on the remote directory.

Here’s the link to download WinSCP:

After you install WinSCP you should see a page like this:

Make sure you set the File Protocol to FTP.

Now go to Azure
Here’s the link to Azure: http://portal.azure.com/

Now go into azure to find the Host Name, User Name, and Password

In the current portal you’ll find all the information on the Dashboard.
You can find the FTP hostname and the Username about halfway down the page on the right.

And if you don’t know your password you can set deployment credentials from the same page. Simply click here:


Set your credentials, and remember your password.


Now open WinSCP and enter your credentials alongside the FTP Host Name


Now that you’re logged in your can explore the files just like your regular file explorer!
We’re going to find the header file of your current theme and add the code snippet!

Check the path and the highlighted file!


Now double click on that file to open it in your favorite text editor.


Here you can see where I’ve pasted in my code.

Save the file and it will be saved on your Azure directory and you’re ready to go!

You can double check to see the changes.
Go back to your azure portal and actually click on the FTP host link.
This will open a new tab and will ask for the same credentials.


Once inside you’ll be able to explore the Directory contents in your browser.

Check the path at the top to see my current location and notice that I can open the file right here to check the contents!


Looks good from here too!


Now everytime anyone opens a page on your blog data traffic data will be sent to your analytics platform.

Let me know if you have any questions!

The Kannon at //Build. This could be a really great story.
The Kannon at //Build.