Skip to content

Instantly share code, notes, and snippets.

@markhallen
markhallen / test_accounts_service.rb
Last active Jun 29, 2021
Add multiple accounts for testing based on a single email address
View test_accounts_service.rb
# Add multiple accounts for testing based on a single email address
class TestAccountsService
MAX_TRIES = 10
def self.call(emails)
email_addresses = []
Array(emails).each do |email|
email.downcase!
name = name_from_email(email)
create_support_user(email, name)
View Get-CMClientLogFiles.ps1
<#
.SYNOPSIS
This script was created for use in ConfigMger Run Scripts
.DESCRIPTION
The client log files will be copied to a network share
.PARAMETER Logshare
Specifies the target share upon which to save the log files
.EXAMPLE
Get-CMClientLogFiles.ps1 -Logshare '\\server\share'
#>
View Add-LocalAdministrator.ps1
<#
.SYNOPSIS
This script was created for use in ConfigMger Run Scripts
.DESCRIPTION
The Members
.PARAMETER Member
Specifies an array of users or groups that this cmdlet adds to a security group.
You can specify users or groups by name or security ID (SID).
.EXAMPLE
Add-LocalAdministrator.ps1 -Member 'domain\user'
View addChildListListener.jsx
// listen for creation of a modal
$(document).on('click', '.modal-with-react', function() {
addChildListListener('modal-holder')
})
export function addChildListListener(elementId){
// Select the node that will be observed for mutations
const targetNode = document.getElementById(elementId)
// Options for the observer (which mutations to observe)
View listenForModal.jsx
// crude first implementation for proof
document.addEventListener('DOMContentLoaded', () => {
// Select the node that will be observed for mutations
const targetNode = document.getElementById('modal-holder');
// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: true, subtree: true };
// Callback function to execute when mutations are observed
@markhallen
markhallen / profiles.json
Created Nov 5, 2019
Windows Terminal with PowerShell 7 instaled from MSIX
View profiles.json
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
View Uninstall-WindowsInstallerSource.ps1
<#
.SYNOPSIS
Uninstall a package when the original source media is unavailable locally.
.DESCRIPTION
A new location will be added to SOURCELIST so that Windows Installer can locate the media. The script uses MSI files
located in the current directory or Path and will set an additional SOURCELIST for each before attempting to uninstall.
.PARAMETER Path
[Optional] This is the folder that will contain the Windows Installer source.
@markhallen
markhallen / Install-Font.ps1
Created Oct 30, 2018
Install font files in Windows 10. Font files should be in the same folder as the script file.
View Install-Font.ps1
$shell = New-Object -ComObject Shell.Application
foreach ($font in $shell.Namespace($PSScriptRoot).Items()) {
if (($font.Path).ToLower() -like "*.ttf" -or ($font.Path).ToLower() -like "*.otf" -or ($font.Path).ToLower() -like "*.ttc") {
if (-not (Test-Path ($env:windir + "\Fonts\" + $font.Path.Split("\")[-1]) -ErrorAction SilentlyContinue)) {
$font.InvokeVerbEx("Install")
}
}
}
@markhallen
markhallen / amplitude_data_tags.js.coffee
Created Oct 15, 2018
Use data-log in tags for amplitude.com events
View amplitude_data_tags.js.coffee
$(document).on 'turbolinks:load', ->
$("a[data-log]").click (event) ->
logEvent = $(this).data("log")
amplitude.getInstance().logEvent(logEvent)
View Remove-ApplicationByDisplayName.ps1
Function Remove-ApplicationByDisplayName
{
<#
.SYNOPSIS
Remove an application from Windows
.DESCRIPTION
Will accept a DisplayName value that will be searched for in Programs and Features and will
uninstall the applicationg.
.PARAMETER DisplayName
The DisplayName as it found in Programs and Features