Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
@mojavelinux
mojavelinux / Writing Tools Writeup.markdown
Created January 30, 2012 18:56 — forked from matthewmccullough/Writing Tools Writeup.md
How To Write A Technical Book (One Man's Modest Suggestions)
@JustinGrote
JustinGrote / Enable-PowershellSSHRemoting.ps1
Created December 28, 2018 01:44
Enable Powershell Core 6 SSH Remoting on Windows
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Enabled Powershell Remoting Over SSH.
.NOTES
Currently assumes you have installed openssh and powershell core, preferably via chocolatey as such:
choco install powershell-core -y
choco install openssh -y -params '"/SSHServerFeature /PathSpecsToProbeForShellEXEString:$env:programfiles\PowerShell\*\pwsh.exe"'
#>
[CmdletBinding()]
@murrahjm
murrahjm / psinventory.ps1
Created September 18, 2019 13:02
ansible dynamic inventory script in powershell
#!/usr/bin/env powershell
if ($args -contains '--list') {
$output = @{
'all' = @('server1.domain.com', 'server2.domain.com')
'webservers' = @('server1.domain.com')
'_meta' = @{
'hostvars' = @{
'server1.domain.com' = @{
myvar = 'metavariable'
@markwragg
markwragg / mactweaks.md
Last active April 25, 2023 18:10
Mac tweaks

Changes to my Mac

Turn off "press and hold" for foreign letters, allowing you to then press and hold for repeat letters. Open Terminal and run:

defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

Then you need to close/reopen any app before it takes effect.

Make the dock appear faster when using auto hide:

@lilongen
lilongen / run-ansible-with-any-host-without-inventory
Last active May 5, 2023 23:16
How to run Ansible without specifying the inventory but the host directly?
Question:
. How to run Ansible without specifying the inventory but the host directly?
. Run a playbook or command with arbitrary host not in the inventory hosts list?
. run ansible with arbitrary host/ip without inventory?
Answer:
Surprisingly, the trick is to append a ,
The host parameter preceding the , can be either a hostname or an IPv4/v6 address.
ansible all -i example.com,
@alexedwards
alexedwards / go-update
Created November 22, 2023 14:53
Bash script for updating Go
#!/bin/bash
# Check if the version argument is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <go_version>"
exit 1
fi
# Version number provided as an argument
version="$1"
@arebee
arebee / createPodcastRss.ps1
Last active February 24, 2024 01:29
Powershell script to create an RSS feed from a local set of MP3s
# Based on the format described at http://podcast411.com/howto_1.html
function createRssElement{
param(
[string]$elementName,
[string]$value,
$parent
)
$thisNode = $rss.CreateElement($elementName)
@MarkTiedemann
MarkTiedemann / download-latest-release.ps1
Last active March 4, 2024 18:39
Download latest GitHub release via Powershell
# Download latest dotnet/codeformatter release from github
$repo = "dotnet/codeformatter"
$file = "CodeFormatter.zip"
$releases = "https://api.github.com/repos/$repo/releases"
Write-Host Determining latest release
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name
@alexedwards
alexedwards / gist:dc3145c8e2e6d2fd6cd9
Last active April 9, 2024 05:30
Example of working with Go's database/sql and NULL fields
CREATE TABLE books (
isbn char(14) NOT NULL,
title varchar(255),
author varchar(255),
price decimal(5,2)
);
INSERT INTO books (isbn, title, author, price) VALUES
('978-1503261969', 'Emma', 'Jayne Austen', 9.44),
('978-1514274873', 'Journal of a Soldier', NULL, 5.49),