Getting Started With Ansible on Azure VMs Apr 10, 2020 Here’s some notes I took during the excellent Getting Started with Ansible on Windows course on Pluralsight, specific to Azure VMs. I was trying to set up a cluster of servers to use as Azure Devops build agents, so my notes all relate to that. Create some Azure VMs using a script like this one Add networking rules to each to allow WinRM over HTTPS: inbound TCP port 5986 (my example script above already does this) Also run the ConfigureRemotingForAnsible script (my example script does this too) Ansible’s win_ping module doesn’t actually use ICMP ping so if you have issues with it, they aren’t related to a firewall blocking pings. ...
Recolouring Images With a Colormatrix Mar 22, 2020 I fell in love with this wallpaper ("Sunny Stag” by Robert Farkas) the moment I saw it: However I prefer dark themes and darker-coloured wallpapers, the original was a bit too bright for me. One Reddit user had made some inverted versions but I wanted a similar-coloured stag on a dark background (i.e. the colours should stay mostly the same). I use NegativeScreen all the time to darken my screens because it has “smart inversion” modes, which mostly preserve colours while still making things darker. ...
One-liner to check/uncheck every checkbox on a page Mar 12, 2020 Press F12, click console and paste this in there. [].slice.call(document.querySelectorAll(“input”)).forEach(i => i.checked=true)
String.LastIndexOf, but in T-SQL (handy for getting file extensions) Mar 09, 2020 Note that this doesn’t work on the “text” datatype, so you’ll need to cast to nvarchar… SELECT LEN(FileName) - CHARINDEX('.', REVERSE(FileName)) AS ‘LastIndex’, RIGHT(FileName, CHARINDEX('.', REVERSE(FileName))) AS ‘FileExtension’ – still includes the dot FROM Files
Export every field of every record of a bunch of Salesforce objects Mar 04, 2020 I needed to get a backup of every record of a bunch of objects (for posterity) which were about to be deleted, I wanted to grab every field and do it in one line. I cheated a little, because I’ve defined some functions that just do some of the basic processing. I could put the whole function definitions on one line too, but that’d be a bit contrived ;) They’re below for reference ...
Combine many CSVs into batches of a specified size with Powershell Mar 02, 2020 $batchMaxSize = 9.5MB $allFiles = Get-ChildItem 'fileLocation\*.csv' $batchNumber = 0; $batchMagnitude = $allFiles.Count.ToString().Length # group the files together until there's none left while ($allFiles.Count -gt 0) { $batchNumber++; $batchSuffix = $batchNumber.ToString().PadLeft($batchMagnitude,"0"); $totalSize = 0; # add the file sizes together, keeping a running total until it exceeds the max $batchFiles = $allFiles | where {$totalSize += $_.Length; $totalSize -lt $batchMaxSize}; # combine the files in memory - don't need to deal with headers ...
Exporting from an SQL database (e.g. Dynamics) into Salesforce, without Excel Jan 06, 2020 Whenever you paste content into it, Excel likes to be helpful and reformat it according to what it thinks you’re doing (e.g. format dates, interpret formulae), but often with CSVs it gets this wrong and messes up your carefully-formatted raw data. This was getting pretty frustrating, so rather than figuring out workarounds for Excel’s weirdness, here’s how to cut out the middleman and get the output of an SQL query directly into Salesforce. ...
Count all Salesforce records of all object types owned by a specific user Dec 12, 2019 It’s not the fastest or most elegant script, but using the Force.com CLI it’s pretty easy to get a count of objects (of all types) owned by a specific user. It assumes that the field to be checked is ownerid, though, so might not work if you have other fields. A slightly better way might be to check which objects have an ownerid field first. $ErrorActionPreference = ‘SilentlyContinue' $objects = force sobject list ...
Umbraco SQL query snippets Dec 10, 2019 Selecting properties of a content item: SELECT cast([xml] as xml) as ‘xmldata’, nodeId FROM dbo.cmsContentXml WHERE nodeId = ‘1234’ –ID from the node in Umbraco
OTF fonts (e.g. Fira Code) look nasty on gVim in Windows Nov 10, 2019 I really like the “Fira Code” font but it always looked nasty in gVim on Windows (my main text editor besides VS), and I really don’t want to use a different font for each editor. After spending literally hours fiddling with stuff like the guifont setting, different font/size combos, custom font renderers (e.g. MacType), I finally realised the fonts themselves aren’t the problem, nor the rendering settings. The problem was that the chocolatey installer I had used installed OTF versions of the files, which gVim always used by default even if the TTF versions of them were installed. ...