Posts

Getting SSH agent passthrough working with VS code

(Updated 2023-04-24) I had frustrations getting SSH agent passthrough working with VS code such that when I was remoted onto a linux box and working with git, I wasn't able to use the git functions inside code as the auth was failing. Doing the following worked for me at an administrator powershell prompt on your own machine Set-Service ssh-agent -StartupType Automatic Start-Service ssh-agent Once you've got pageant or similar loading your keys then this should all work. You might need to add entries similar to below into your local ssh config file to ForwardAgent yes: Host remotehostname      User yourusername      ForwardAgent yes Also make sure that you've got your ssh identity loaded Use the following to list identities 'ssh-add -l' and the following to add your id_rsa key 'ssh-add ~/.ssh/id_rsa' Troubleshooting "ssh -V" to get the version. Try using "ssh -vT git@github.com" to test the forwarding. Due to bugs in the version of openss...

Removing credentials from your git repo

It happens... Occasionally a file you REALLY didn't want in your git repo is in there and you don't spot it until several days/months/years later! Worst case is that it's some credentials. First thing you do is change any affected systems where credentials may have been inadvertently been exposed. Make a backup of your repo using something like git clone --mirror <repo> Then as per  https://help.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository   you can remove the offending file. Don't forget the if the path to your file is in a sub-folder to use the correct slash, most likely "/" even on Windows. git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA " \ --prune-empty --tag-name-filter cat -- --all Then you can push your repo up and overwrite what's there. git push origin --force --all Other users may then have to do the following git fet...

Windows Terminal 1.0 released

Image
The first stable release of Windows Terminal 1.0 has been released . I've been using this for a while now and with version 1.0 it's finally moved to a stable release. So why/what's this about? There's plenty of articles online about this so do a search online to get more information but the main advantages/features are: a customisable terminal at last multiple tabs works with various shells including cmd, wsl, powershell, cmd, bash etc  image backgrounds high performance as it can use GPU driven rendering. Integrate posh-git and powerline fonts to give yourself a pretty prompt  as described by Scott Hanselman:

Ansible on Ubuntu 18.04 on WSL

Installing Ansible on Ubuntu 18.04 on WSL. There's a few hiccups in the install process and it's necessary to modify the way the drives are mounted. sudo apt update sudo apt install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt update sudo apt install ansible Once WSL is up and running, create/modify the /etc/wsl.conf to include the following: #Let’s enable extra metadata options by default [automount] options = "metadata,umask=22,fmask=11" This will ensure that the folders and files aren't just world writeable by default. The metadata flag allows writing separate linux permissions from the windows permissions, they can't be more permissive but you can restrict further to make various linux binaries happier about their execution environment. See https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/ for more details.

Android 9 Pie is out - Even better

Having used the beta for a while, I knew that Android 9 was a nice update to the OS. It's finally out, on certain devices anyway. Delivered over the air from today on Pixel devices. https://www.android.com/versions/pie-9-0/

Debugging multiple PHP projects with VS Code and Laragon

Laragon is a great solution for developing PHP, and especially Laravel, projects on Windows. It bundles together Apache, PHP, MySql and automatic host resolution based on folder names. It's great... Until... You try and debug in VS Code using XDebug when multiple sites on your local machine are hit in quick succession resulting in multiple connections from apache being opened against port 9000 on your VS Code instance at the same time. This manifests itself in VS Code by not hitting any breakpoints and just showing "Request 1" and "Request 2", or similar, in the debug call stack. In my environment, I have a main project containing middleware that does a security check against a second project before hitting my main action in my controller. Both PHP instances fire off their XDebug connections on port 9000, as xdebug.remote_autostart=1 in the PHP ini file. Normally this is fine as only one project is practically running at once, but the middleware cause...

Reformatting a php.ini file with Sublime Text 3 for use with Ansible

So quite a specific post this... PHP .env files are of the format KEY_A=true KEY_B="This Is Another Value" To set variables for use with a Jinja2 template they need to be something along the lines of key_a: true key_b: ThisIsAnotherValue In Sublime Text in the replace all (CTRL+H) Make sure that regex matching is on and not to preserve case. Find What: (.+)=(.+) Replace With: \L$1\E: $2 This will replace two groups of one or more characters. The first will be lowercased, the equals replaced with a colon and then the second group in its original case. Then the original .env file can have the following in the Jinja2 template KEY_A={{key_a}} KEY_B={{key_b}}