Skip to content

Instantly share code, notes, and snippets.

@pcrockett
pcrockett / new_file_command.py
Created March 21, 2023 13:05
Example of a very basic "new file" command you can add to your Sublime config
import os
import sublime
import sublime_plugin
from typing import Optional
# Place this file in your Users directory, right next to your user
# preferences file.
#
# To add this command to your command palette, just add the following
@pcrockett
pcrockett / pinger.sh
Created February 8, 2021 18:24
Inspired by Matt's Traceroute, but more friendly for logging
#!/usr/bin/env bash
# LICENSE: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html
set -Eeuo pipefail
[[ "${BASH_VERSINFO[0]}" -lt 5 ]] && echo "Bash >= 5 required" && exit 1
readonly DEPENDENCIES=(ping)
readonly SCRIPT_NAME=$(basename "${0}")
@pcrockett
pcrockett / Disable-BingSearch.ps1
Created February 24, 2020 11:53
Disable Bing search and Cortana in the Windows 10 Start Menu
<#
.SYNOPSIS
Disable Bing search in the Windows 10 Start Menu
.DESCRIPTION
Inspired by https://www.windowscentral.com/how-fix-taskbar-search-not-working-windows-10
#>
[CmdletBinding()]
param()
$ErrorActionPreference = "Stop"
@pcrockett
pcrockett / unattended-upgrade.sh
Created July 13, 2019 14:30
Unattended security updates with healthcheck.io monitoring
#!/bin/bash
#
# sudo apt install unattended-upgrades
#
# crontab example:
# 0 4 * * * /home/user/unattended-upgrade.sh >/home/user/upgrade-log 2>&1
#
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
@pcrockett
pcrockett / markdown-style.css
Last active June 28, 2019 06:51
My preferred Markdown style
/*
Inspired by https://github.com/raycon/vscode-markdown-style
*/
body {
color: #d2d2d2;
background-color: #2e2e2e;
max-width: 50em;
margin-left: auto;
margin-right: auto;
@pcrockett
pcrockett / template.sh
Last active July 31, 2022 01:13
Bash script template
#!/usr/bin/env bash
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors

Keybase proof

I hereby claim:

  • I am pcrockett on github.
  • I am pcrock (https://keybase.io/pcrock) on keybase.
  • I have a public key whose fingerprint is 7DDE 18D1 9261 CD61 6E2B E735 3265 A73D 33E1 EAA7

To claim this, I am signing this object:

@pcrockett
pcrockett / Sign.ps1
Last active May 3, 2023 19:10
PowerShell script to cryptographically sign assemblies that's easy to use with a Continuous Integration server
$script:SignToolPath = "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe"
$script:TimestampServers = "http://timestamp.comodoca.com/authenticode",
"http://timestamp.verisign.com/scripts/timestamp.dll",
"http://timestamp.digicert.com"
$script:TimestampServerIndex = 0
$script:MaxRetries = 7
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 3.0