Skip to content

Instantly share code, notes, and snippets.

View jetersen's full-sized avatar
🥰
release-drafter 🚀

Joseph Petersen jetersen

🥰
release-drafter 🚀
View GitHub Profile
@jetersen
jetersen / README.md
Last active November 4, 2019 08:27
Change user password with freedom on Windows

Windows for some reason does not allow user to copy/paste password when using their interface to change password.

However when you rely on password managers it can be somewhat frustrating to input longer password, so you tend to cheap out.

This script tries to fix Windows shortcomings and actually provide users with the freedom to change password in a secure way.

Usage:

Here the script will default to logged in user

@jetersen
jetersen / README.md
Last active March 8, 2020 11:47
Windows Server SChannel only have TLS 1.1 and TLS 1.2 enabled. TLS 1.0 is disabled since it is considered weak!

Windows Server SChannel settings

Disabled Protocols

  • SSL 2
  • SSL 3
  • TLS 1.0

Enabled Protocols

@jetersen
jetersen / getLatestVersionOfPluginsToMaven.groovy
Last active November 6, 2019 06:24
Produces a Jenkins plugins.txt with the updated versions of plugins.
//this will produce dependencies xml to be put into a dependencies block inside a pom.xml with the updated plugin version.
def plugins = Jenkins.instance.pluginManager.plugins.toSorted()
plugins.each { plugin ->
def attrs = plugin.getManifest().mainAttributes
def update = plugin.updateInfo
def version = "${plugin.version}"
if (update != null) {
version = "${update.version}"
println "<!-- Upgraded ${plugin.shortName} from ${plugin.version} to ${update.version} -->"
}
@jetersen
jetersen / EnableTLS12.ps1
Last active May 30, 2023 08:17
Enable TLS 1.2 for .NET application including Windows PowerShell and .NET 45 and below
#requires -runasadministrator
# set strong cryptography on 64 bit .Net Framework
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v2.0.50727' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v2.0.50727' -Name 'SystemDefaultTlsVersions' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SystemDefaultTlsVersions' -Value '1' -Type DWord
# set strong cryptography on 32 bit .Net Framework
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
@jetersen
jetersen / add-cert.py
Created March 8, 2020 09:00
Python: add custom root ca to certifi store
import requests
import certifi
import sys
try:
requests.get('https://any-website-protected-by-your-custom-root-ca')
print('Certificate already added to the certifi store')
sys.exit(0)
except requests.exceptions.SSLError as err:
print('SSL Error. Adding custom certs to Certifi store...')
@jetersen
jetersen / README.md
Last active March 30, 2020 10:02
Enable Always Open checkbox in chromium

How to enable Always Open Checkbox in Chromium again

In version 77 of Chromium (Chrome, Edge, Opera and etc) the always open checkbox was hidden unless renabled by settings.

The always open checkbox is for instance helpful if you join a lot of zoom meetings.

The preference you want to enable is ExternalProtocolDialogShowAlwaysOpenCheckbox which is different for each OS.

MacOS

Keybase proof

I hereby claim:

  • I am jetersen on github.
  • I am jetersen (https://keybase.io/jetersen) on keybase.
  • I have a public key whose fingerprint is 3688 0659 4A96 9FBF 5772 17D9 0575 6914 983D A9E9

To claim this, I am signing this object:

@jetersen
jetersen / git-remote.ps1
Last active August 6, 2020 08:50
Change git remote username directly in git config file
$gitConfigs = Get-ChildItem "C:\git\code" -Include config -File -Recurse -Force | Where-Object { $_.FullName -match "\.git\\config" }
$count = $gitConfigs.Count
for ($i = 0; $i -lt $count; $i++) {
$config = $gitConfigs[$i]
$content = Get-Content $config
if (($content | ForEach-Object { $_ -match 'casz/|Jetersen/'}) -contains $true) {
$content | `
ForEach-Object { $_ -ireplace 'casz/','jetersen/' -replace 'Jetersen/','jetersen/' } | `
Set-Content -Path $config
}
@jetersen
jetersen / README.md
Last active July 29, 2022 09:02
Bulk Pull Requests Update of GitHub Action workflows

Bulk Pull Requests Update of GitHub Action workflows

This is a bulk update script that attempts to upgrade files to use reusable workflow to simplify the work for the plugin maintainers. See this Pull Request search for a successful run: https://github.com/pulls?q=is%3Apr+is%3Aopen+author%3A%40me+archived%3Afalse+sort%3Aupdated-desc+chore%3A+use+jenkins+infra+maven+cd+reusable+workflow

This uses multi-gitter although currently it does not support signed commits and currently I have an open PR that fixes repository listing for repositories without push permissions: lindell/multi-gitter#262

Atm using my PR and multi-gitter print "pwsh $PWD/maven-cd-reusable-workflow.ps1" --config multi-gitter-config.yaml

@jetersen
jetersen / Clear-WindowsUpdateCache.ps1
Created September 27, 2022 13:55
Clear Windows Update Cache
$service = Get-service "windows update"
$service | Stop-Service
Remove-Item -Recurse -Force "C:\Windows\SoftwareDistribution\Download"
$service | Start-Service