Skip to content

Instantly share code, notes, and snippets.

second ssh

run a second copy of sshd and enable root login without pam or password

cat << EOF > /etc/ssh/authorized_keys2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQiKlpq/LIhf3Q145pgUP0QbRrbRTSA7SVmuW69Y0wAu3VXSTDwyCYokBVfF1q0FaIFcYHn1xUG+XDiKVQhlQKN1WEZ0wLcpFs7xYfxtQs9lH8WxdQtcXqOAeZB5/cFLYFQyB4YHpow6rlJ8V4F56GdCktDbclV2U1AD/hctdilk1Izr3wkdNIlHbAWl/VYnYlVbW6jMz6c/3XOQizoqwdhkpJao64n43/1u2B4cePyHravOU1gMElIDbZDt0Svv3iAX2nsT8dZRgCxaT8XSB9qQlbLumUWcjPueg9k3ZGNzp9hia5LWsiaMPWy1xI9y5ZtKhfEdJxGjwHb0ZFN6obaiUZ+BPxajCSWOAmSRh5V5yctnUihCKA6QMfjJZnaimZGssYHUmVAEJJHnIWWxqfZtzwK8o1mKJ5ATP7dTFuDZa5U7su1eq0qP3Yt+1gev71CRzwOf0BErmWQ0sLKC6C6uL6ap1DkD65BK39H/gmscvISRDUvguJIAoTUJi6zfk= root@host
EOF
@craig-m-unsw
craig-m-unsw / WingetUpgrade.ps1
Created December 20, 2022 10:26 — forked from alkampfergit/WingetUpgrade.ps1
Upgrade with Winget being able to select list of software to skip
class Software {
[string]$Name
[string]$Id
[string]$Version
[string]$AvailableVersion
}
$upgradeResult = winget upgrade | Out-String
$lines = $upgradeResult.Split([Environment]::NewLine)
@craig-m-unsw
craig-m-unsw / 01-directory-structure.md
Created December 15, 2022 09:57 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@craig-m-unsw
craig-m-unsw / WinGet-setup-apps.ps1
Last active November 18, 2022 01:15 — forked from codebytes/DevMachineSetup.ps1
Install Winget + packages on Windows 11
<#
name:
WinGet-setup-apps.ps1
desc:
Install Winget + packages on Windows 11
Based on these gists:
- https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
- https://gist.github.com/Codebytes/29bf18015f6e93fca9421df73c6e512c
#>
@craig-m-unsw
craig-m-unsw / README.md
Last active November 28, 2023 22:40
build chef bento box virtual machines with packer

Test VM

Use the chef bento project to build the Vagrant boxes.

Tested November 2023 on:

  • Ubuntu 22.04.3 LTS (Jammy Jellyfish)
  • Virtual Box 7.0.12 r159484 (Qt5.15.3)
  • Packer 1.9.4
  • Vagrant 2.4.0
@craig-m-unsw
craig-m-unsw / linkers.md
Created November 10, 2022 16:33 — forked from jvns/linkers.md
Notes on linkers

How to read an executable

I used to think that executables were totally impenetrable. I'd compile a C program, and then that was it! I had a Magical Binary Executable that I could no longer read.

It is not so! Executable file formats are regular file formats that you can understand. I'll explain some simple tools to start! We'll working on Linux, with ELF binaries. (binaries are kind of the definition of platform-specific, so this is all platform-specific.)

Let's write a simple C program, hello.c:

#include 
@craig-m-unsw
craig-m-unsw / PSADT-Cheatsheet.ps1
Created October 25, 2022 05:29 — forked from leeramsay/PSADT-Cheatsheet.ps1
PSADT snippits/cheatsheet
## Commonly used PSADT env variables
$envCommonDesktop # C:\Users\Public\Desktop
$envCommonStartMenuPrograms # C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$envProgramFiles # C:\Program Files
$envProgramFilesX86 # C:\Program Files (x86)
$envProgramData # c:\ProgramData
$envUserDesktop # c:\Users\{user currently logged in}\Desktop
$envUserStartMenuPrograms # c:\Users\{user currently logged in}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$envSystemDrive # c:
$envWinDir # c:\windows
@craig-m-unsw
craig-m-unsw / README.MD
Last active May 17, 2023 23:38
Use PowerShell on Windows / MacOS / Linux (RHEL, Ubuntu, Alpine, RPI).

cross platform pwsh core

PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core

source: Wikipedia. PowerShell 7.2 runs on:

  1. Windows (installed by default from Win8 onwards)
  2. MacOS
  3. Linux
@craig-m-unsw
craig-m-unsw / age-calc.py
Last active November 28, 2023 22:40
age-calc.py - return current age (years, months, days) from a date of birth.
#!/usr/bin/env python3
'''
to run age-calc.py from docker:
docker run -it --rm --name age-calc --mount type=bind,source="$(pwd)/age-calc.py",target=/app/age-calc.py \
--network none python:3 python /app/age-calc.py 20/10/2010
'''
import sys