Posts Tagged ‘git’

Experimenting with setting up a new machine every third month

April 3rd, 2019

I am currently experimenting with using a virtual machine for my development. I have earlier done it through OSX/Win by the means of Parallells but now I am trying a Win/Win solution with Hyper-V.

Every 30 days or third month, I have seen both, is for how long the license is valid, I do a Hyper-V Manager->Quick create->Windows 10 dev environment and 30 minutes later, or so, the new VM is up and running.

Microsoft packages and delivers the new download on the very day of expiry so it is not possible to download a VM a day before and prep it.
It means the VM is out of date the moment you have installed the new one.

But there is a work around, open a console in admin and

1
slmgr –rearm
and you have 90(?) new days. This can only be done once per VM.

Also note that the Hyper-V manager gui, as depicted below, does not refresh its “Create virtual-machine”-content so the date of the template might be old. Restart (the host machine?) to refresh it.

The mandatory screen shot.

It comes with Visual studio, Visual studio code, Powershell 6 and some dotnet preinstalled. All I have to do is start VS and tell it to update itself..

Then I need Git, Notepad++, VSCode, Posh-git Keyboard1337 and BecerroInamovible. Ergo I need Chocolatey too.

Here is how I do it, the explained way

Fire up a console with elevated priveges.

Window-button, cmd, ctrl-shift-enter. Enter.


1
Window-button, cmd, ctrl-shift-enter. Enter.

Install Chocolatey.


1
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Restart console.

I have checked that all chocolatey packages I reference are “trusted package”. I cannot know if they packages remain “trusted package” at the time you are reading this. The choice is yours.


1
2
Exit. Enter.
Window-button, cmd, ctrl-shift-enter. Enter.

Install Git.


1
choco install git.install

1
winget install --id Git.Git -e --source winget

Install Notepad++.


1
choco install notepadplusplus.install

Install Posh-Git


1
2
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
Add-PoshGitToProfile -AllHosts

To make it even cooler one can install more stuff, like oh-my-posh. For it to work one needs a new font “Cascadia Code”, and Windows terminal has to be updated to use it.

1
"fontFace":  "Cascadia Code PL"

1
Import-Module oh-my-posh

1
Set-ThemeParadox

I like to have a clear separator by every promp. So I might add a newline before the prompt


1
$GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n'

Install Powershell core


1
choco install powershell-core

or


1
winget install --name PowerShell --exact

Install Keyboard1337.

I believe Keyboard1337 is a zip if you git clone BecarroInamovible. If so, you don’t have to download Keyboard1337.

Otherwise download

1
Keyboad 1337.zip
. Unblock. Unpack. Install.
Run Keyboard 1337\l337\setup.exe (yupp. there’s a typo there)
Language preferences -> Keep English(Sweden) and English(United States). The latter is Keyboard1337

BecerroInamovible

It has a dependency on Autohotkey.


1
choco install autohotkey

Copy contents of

1
https://raw.githubusercontent.com/LosManos/keyboard1337/master/BecerroInamovible.ahk
to
1
C:\DATA\PROJEKT\Keyboard1337

As an alternative do ”

1
git clone https://github.com/LosManos/keyboard1337.git

Selfelected1337

Not mentioned above, and not, yet, public I use the world’s first non-fixed programmer font called Selfelected1337.

Get it and install it.

Vscode

To make it work in VSCode. Open settings.json (ctrl-shift-p)settings.json

Update it with

“editor.fontFamily”: “Selfelected1337, Consolas, ‘Courier New’, monospace”,

To make the active tab stand out. Update settings.json with

“workbench.colorCustomizations”: {        “tab.activeBackground”: “#00aaff”    }

As short as possible:

@”%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command “iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))” && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin”

choco install git.install -y & choco install notepadplusplus.install -y & choco install autohotkey -yt
choco install kubernetes-cli
winget install Microsoft.PowerShell
winget install “visual studio code”
winget install -e –id Microsoft.AzureCLI

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Start a powershell terminal:

PowerShellGet\Install-Module posh-git -Scope CurrentUser ; Add-PoshGitToProfile -AllHosts

notepad $profile

And in the resulting file input

$GitPromptSettings.DefaultPromptPrefix.Text = ‘*** $(Get-Date -f “yyyy-MM-dd HH:mm:ss”) `n’

Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

In a powershell terminal:

mkdir c:\DATA ; mkdir c:\DATA\PROJEKT ; pushd c:\DATA\PROJEKT ; git clone https://github.com/LosManos/keyboard1337.git ;

& ‘C:\Program Files\AutoHotkey\AutoHotkeyU64.exe’ C:\DATA\PROJEKT\keyboard1337\BecerroInamovible.ahk ;

Expand-Archive ‘C:\DATA\PROJEKT\keyboard1337\Keyboard 1337.zip’ -DestinationPath C:\DATA\PROJEKT\keyboard1337\ ; C:\DATA\PROJEKT\keyboard1337\l337\setup.exe

git – github – source tree

August 14th, 2017

I thought of calling this article The value of tools.

I started with git at the command prompt. The threshold was high. Not only was the way of treating my precious source code files new but I also had to learn new commands and how to parse the returned text.

Then came what is now called Github desktop. It made simple tasks even simpler. It couldn’t do any hard tasks but I was perfectly comfortable with this since 99% of my tasks are simple. It is just when I mess up Git I need more horse power.

So came Source tree which made harder tasks easier. Not Easy since one has to be concentrated; and Source tree has a number a bugs and caveats that makes it not as simple to use as Github desktop.

A client that is very good for what it is good at might suffice.
To build a graphical tool for Git that is both easy to use for less knowledgable people and complete for an advanced Git user is hard, even impossible.

Alas: The solution to build a simple tool for simple tasks and an advanced tool for advanced tasks is a good idea.

Using Git for Windows with Atlassian Bitbucket

July 4th, 2012

The real article is here.

I like how the Git-for-windows application is very clean.  But I don’t like how it doesn’t give the user any clues.  Like: I know I can add a new repository by clicking the add button but there is no way for me to see that I can reference an existing by dragdropping a folder.  Maybe I can do this by the same add button but I can’t see it.

It also doesn’t give the user any clue about d’esprit of Git.  Giving Git a GUI that catches the spirit while being easy to use would be quite a feat.  I dare to say that if I started building such an application I would lose track of ease-to-use at the same pace as I gathered Git knowledge.

For the newbie I recommend Git for windows.  Silverbacks need more gauges and levers and will use the command line.

Back to spirits.  I learned the basics of Git through the well written post as Github.