Creating a self signed SSL certificate on Windows using PowerShell

Run this PowerShell command as Administrator:

New-SelfSignedCertificate –DnsName *.local-dev.com –CertStoreLocation cert:\LocalMachine\My

Open Manage Computer Certificates (typing certificates in the Start menu should find it)

Open Personal\Certificates

Find the *.local-dev.com certificate that has an expiration date of a year from today. Delete any others for *.local-dev.com to avoid confusion later on.

Right-click and choose Copy.

Navigate to Trusted Root Certification Authorities\Certificates

Right-click and paste.

Restart your machine.

In IIS, update the bindings for all sites to use the SSL certificate created above, it will be called *.local-dev.com.

Source: https://kx.cloudingenium.com/microsoft/powershell/how-to-create-a-self-signed-san-certificate-on-powershell/

Posted in Uncategorized | Comments Off on Creating a self signed SSL certificate on Windows using PowerShell

Deleting local git branches that have been merged on the remote using PowerShell

This is useful but hard to find a PowerShell version of. I found it here:

git branch --merged | %{$_.trim()} | ?{$_ -notmatch 'develop' -and $_ -notmatch 'master'} | %{git branch -d $_}
Posted in Uncategorized | Comments Off on Deleting local git branches that have been merged on the remote using PowerShell

Setting all indexes to have zero replicas with Elasticsearch

To configure all indexes (including existing ones) to have zero replicas (useful if running on only one server, e.g. in development), execute this (syntax assumes you’re using Sense):

PUT /_settings
{
“index” : {
“number_of_replicas” : 0
}
}

Then check it’s worked by running this:

GET /_cat/indices?v

Posted in Uncategorized | Comments Off on Setting all indexes to have zero replicas with Elasticsearch

Stdout logging in ASP.NET 1.1.1 Azure Web Apps

Because I keep forgetting it:

stdoutLogEnabled="true"
 stdoutLogFile="\\?\%home%\LogFiles\stdout"
Posted in Uncategorized | Comments Off on Stdout logging in ASP.NET 1.1.1 Azure Web Apps

RavenDB: CryptographicException & FormatException: Input string was not in a correct format

If you get an error similar to the below and are using encrypted databases, make sure that you’re running the RavenDB process as the same user you were when the databases were created/encrypted.

The encryption keys are stored in per-user stores by Windows so if you created the database while RavenDB was running as a Windows Service (as LOCAL SYSTEM) and then later run RavenDB directly using Raven.Server.exe it will be running as the logged in user, not LOCAL SYSTEM and won’t have access to the encryption keys.

Raven.Database.Server.Tenancy.AbstractLandlord`1,Warn,,45,Could not unprotect secured db data Raven/Encryption/EncryptIndexes setting the value to '<data could not be decrypted>',"System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.
   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Raven.Database.Server.Tenancy.DatabasesLandlord.Unprotect(DatabaseDocument databaseDocument) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 283
Raven.Database.Server.Controllers.RavenDbApiController,Warn,,45,Could not open database named: XXXX Input string was not in a correct format.,"System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at Raven.Database.Config.InMemoryRavenConfiguration.Initialize() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Config\InMemoryRavenConfiguration.cs:line 339
   at Raven.Database.Server.Tenancy.DatabasesLandlord.CreateConfiguration(String tenantId, DatabaseDocument document, String folderPropName, InMemoryRavenConfiguration parentConfiguration) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 263
   at Raven.Database.Server.Tenancy.DatabasesLandlord.CreateTenantConfiguration(String tenantId, Boolean ignoreDisabledDatabase) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 99
   at Raven.Database.Server.Tenancy.DatabasesLandlord.TryGetOrCreateResourceStore(String tenantId, Task`1& database) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Tenancy\DatabaseLandlord.cs:line 160
   at Raven.Database.Server.Controllers.RavenDbApiController.TrySetupRequestToProperResource(RequestWebApiEventArgs& args) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Controllers\RavenDbApiController.cs:line 618
Posted in Uncategorized | Comments Off on RavenDB: CryptographicException & FormatException: Input string was not in a correct format

Pukka tea tasting notes

I bought a Pukka teas taster pack a few weeks ago, and kept notes so I could remember which ones I wanted to buy more of. These are my personal tastes and opinions, your results may differ!

star anise & cinnamon – “A velvety swirl of organic star anise, cinnamon & ginger” – Good but not sure I’d want to drink a whole box full, perhaps one for winter.

lively english breakfast – “A perky blend of organic whole leaf tea, ginseng & licorice” – Had this with milk. Quite good but a bit “fruity” for tea with milk. Not one I’ll be buying a box of.

three tulsi – “A sacred organic blend flowering with vibrant clarity” – A bit like Jasmine tea, not bad but a bit flowery for me.

lemon, ginger & manuka honey – “A welcoming cup of spicy-sweet organic bliss” – Very good, a classic. Though the manuka honey is only a flavouring, it doesn’t actually contain any. Not so good if left to go cold.

cool mint green – “An organic spearmint splash into green’s goodness” – Pretty much what it says on the tin – green tea with a hint of mint. A good combo – takes the edge of the green tea bitterness. Might buy this one.

rooibos & honeybush – “A copper red charm of organic earthy delight” – Not much to say really, tastes of rooibos – quite nice but not that keen personally.

lemongrass & ginger – “An uplifting organic lemony zing with a flying finish” – Not bad, hard to describe really – not quite as interesting as it sounds. Not interesting enough to consider buying any more. The lemony-ness is very subtle.

licorice & cinnamon – “A luxuriously sweet organic treasure gilded with golden spice” – You can’t really go wrong with this one – very nice, sweet and warming. Would buy again.

lemon & mandarin with lemon verbena – “An organic citrus sensation to cheer your senses” – Not quite as exciting or fruity as it sounds but a good fruity tea, similar to lemon and ginger I guess.

detox – “A lemony spring of organic aniseed, fennel & cardamom” – Nice and refreshing, light, lemony. Doubt it actually detoxes anything though!

elderberry & echinacea with elderflower – “A rich organic embrace tingling with fruity warmth” – Fruity, nice. Hard to distinguish all the flavours but would buy again.

wild apple & cinnamon with ginger – “A sunlit orchard of organic warmth & sweet spice” – Not bad and quite warming though not sure about the apple.

blackcurrant beauty – “Deliciously deep purple organic fruits to help you glow inside and out” – Blackcurranty, not much more to say.

womankind – “A delicate dance of organic cranberry, rose & sweet vanilla” – I had this in a pink mug to match the packaging. Not bad, lots of ingredients but none of them really stood out. Fairly generic “fruity” tea.

clean green – “A fresh burst of pure organic green tea with a luscious lemony lift” – Basically green tea with a hint of lemon. Pretty good though, takes the bitter edge off. I’d buy this if I wanted a green tea.

vanilla chai – “A caffeine-free organic lift flushed with cinnamon warmth” – Nicer than other chai teas I’ve had – I couldn’t really taste the vanilla but it seemed to work.

relax – “A deeply soothing fusion of organic chamomile, fennel & marshmallow root” – I had this on a stressful day to put it to the test – not sure if it worked or not. It was nice but not memorable – I probably wouldn’t buy this again.

sweet vanilla green – “A seductively sweet organic melody of soothing vanilla and whole leaf green tea” – Good but not that sweet and not much vanilla flavour. Better than plain green tea though.

gorgeous earl grey – “An inspiring infusion of organic whole leaf, bergamot & lavendar” – I’m not a massive earl grey fan but this one seemed pretty good – nice and smooth though I was left with a bitter taste when I’d finished the cup.

three ginger – “A warming swirl of organic ginger, galangal & golden turmeric” – It’s a good ginger tea, but it’s just ginger tea – couldn’t taste the other ingredients.

three licorice – “A sweet song of nourishing organic licorice from Kazakhstan, Pakistan & Egypt” – Very good and strong flavour but I think I still prefer the “peppermint & licorice” tea by Pukka.

cleanse – “A radiant blend of organic nettle, fennel & peppermint” – Hard to decribe, tasted mostly of peppermint but not as strong as a pure peppermint. Nice, but a bit boring.

supreme matcha green – “A vital wellspring of organic whole leaf green tea & the finest matcha” – Much like any other green tea I’ve had – a bit bitter but feels like it’s doing you good. The matcha is only 2% so probably more of a marketing gimmick than anything else.

three fennel – “Soothing organic sweet & wild fennel seeds with fennel leaf” – This smells pretty good and tastes ok too – a bit bland but I like it, I just don’t know why.

chamomile, vanilla & manuka honey – “A soothing dip in an organic pool of calm” – I was so calmed when I drank this that I’ve totally forgotten what it tasted like. It contains manuka honey flavouring, not actual manuka honey which is a bit of a swizz.

three cinnamon – “A sweet embrace of organic Indian, Indonesian & Vietnamese cinnamon” – Very cinnamony for obvious reasons – nice flavour, warming and has the best disclaimer – “Do not drink more than 4 cups a day”

night time – “organic oat flower, lavender & limeflower tea for peaceful sleep” – I had this during the afternoon and didn’t fall asleep (fortunately). It was pretty good, drinkable, hard to describe the flavour though – not as exotic a taste as the description might suggest.

revitalise – “A burst of warming organic cinnamon, cardamom & ginger” – Nice, smooth but not particularly memorable.

after dinner – “A delicious digestif of organic sweet fennel, roasted chicory & caradmom” – I had this mid-afternoon but I think it would go well after a big dinner, especially steak or similar.

serene jasmine green – “A sensual haven of organic green jasmine tea, chamomile & lavender” – Doesn’t taste as fancy or complicated as it sounds but good if you like that kind of flavour – I prefer the sweeter flavours personally.

original chai – “A royal flush of organic cinnamon, cardamom & ginger” – My favourite of the chai teas so far, or perhaps it’s just growing on me. I’d consider buying more of this one.

Posted in Uncategorized | Comments Off on Pukka tea tasting notes

PSake: “Exception: Unknown .NET Framework version, 4.6.1 specified in 4.6.1.”

If you get this error, you may have run another PSake script with a different framework version in the same PowerShell session.

Open a new PowerShell window and try again.

Posted in Uncategorized | Comments Off on PSake: “Exception: Unknown .NET Framework version, 4.6.1 specified in 4.6.1.”

Rewriting git history – removing a directory

git filter-branch –force –index-filter ‘git rm –cached -r –ignore-unmatch directoryToRemove’ –prune-empty — –all

git push origin master –force

Posted in Uncategorized | Comments Off on Rewriting git history – removing a directory

Running IISRESET from Visual Studio

If you want a quick way of running IISRESET from within Visual Studio:

Tools > External Tools…

clip_image001

Add a new menu item to run C:\Windows\System32\iisreset.exe (note the checkboxes at the bottom)…

clip_image002

You then get a new menu item…

clip_image003

And the output is displayed in the Output panel…

clip_image004

Depending on your UAC settings, you may need to be running Visual Studio as Administrator for this to work.

Posted in Uncategorized | Comments Off on Running IISRESET from Visual Studio

UAC, Windows 10 and Visual Studio

http://stackoverflow.com/questions/12257110/can-you-force-visual-studio-to-always-run-as-an-administrator-in-windows-8

fix.reg:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
“C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv.exe”=”~ RUNASADMIN”

Posted in Uncategorized | Comments Off on UAC, Windows 10 and Visual Studio