Tahir Hassan's Blog

My Technical Notes

Work Blog

Tuesday, 29 November 2016

Git Setup on a computer For first time use

Firstly, set the name and the email address: `$ git config --global user.name "John Doe"` `$ git config --global user.email johndoe@example.com` Also set a handy alias for s being status: `git config --global alias.s status`

Enabling Cut, Copy and Paste in PowerShell/ConEmu when using PSReadline

On Settings, on the left, go to `Keys & Macros`, and then `Mark/Copy`, untick, `Start selection with Shift+Arrow`.

Tuesday, 30 August 2016

Merging a Branch in Git

This script assumes that the branch `bug-fix` and branch `master` are in order.

Now to delete `bug-fix` branch:

Monday, 15 August 2016

Executing a PowerShell Script via a BAT file and Capturing Output

Friday, 5 August 2016

Pasting an Image into Org Mode on Windows

The following is the answer I posted on StackOverflow.

My solution is for the Windows platform. Many thanks to Assem for giving his solution on which I based mine.

I wrote a C# console app `CbImage2File` that writes the image on the clipboard (if there is one) to a path given as the command line argument. You will need a reference to System.Windows.Forms assembly.

I use Greenshot to take the screenshot, which (via its configuration) automatically copies the screenshot to the clipboard.

I then use a shortcut `C-S-v` to paste the image in the org mode buffer using the function `org-insert-image-from-clipboard`:

This function will work out a file path, then invoke the C# app to create `png` file, then it will add the image tag and then call `org-display-inline-images` to show the image. If there is no image on the clipboard, it will paste in the response from the C# app.

Tuesday, 2 August 2016

Zip a Code Directory using 7zip command line

This solution using the command line application of 7z.

If you have a folder called `myproject`, then we can create a zip file containing this folder using a bat file in the same folder at `myproject`:

If you wish the contents of `myproject` to be the contents of the zip, then you use `.\myproject\*` instead of `.\myproject\`.