Skip to content

Instantly share code, notes, and snippets.

@dakotahawkins
dakotahawkins / update
Created January 9, 2020 16:53
Debian update script
#!/usr/bin/sudo bash
main() {
restart_if_required
run_apt update
run_apt full-upgrade
run_apt autoremove
}
run_apt() {
@dakotahawkins
dakotahawkins / init_db-user.sh
Last active March 18, 2018 19:41
Postgres docker `docker-entrypoint-initdb.d` script to add non-superuser user/password
#!/usr/bin/env bash
####################################################################################################
# Initializes a new non-superuser user and password for use with the database
#
# This may be officially supported soon: https://github.com/docker-library/postgres/issues/175
main() {
file_env 'POSTGRES_DB_USER'
file_env 'POSTGRES_DB_PASSWORD'
@dakotahawkins
dakotahawkins / update-docker-compose.ps1
Created March 15, 2018 19:44
Powershell Script to Update Docker-compose to the Latest Release
# Self-elevate the script if required
# http://www.expta.com/2017/03/how-to-self-elevate-powershell-script.html
If (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
If ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
@dakotahawkins
dakotahawkins / WriteBuildCommitID.bat
Last active February 24, 2016 17:51
Build-log HEAD's commit ID in Windows without access to Git: Behold, the rare and terrible native batch!
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.
ECHO ================================================================================
REM Walk up looking for the "root" directory, containing .git
SET ROOTDIR=%~dp0
:GetRootDir
FOR /F "delims=" %%I IN ("!ROOTDIR!") DO SET ROOTDIR=%%~dpI
### Keybase proof
I hereby claim:
* I am dakotahawkins on github.
* I am dakotahawkins (https://keybase.io/dakotahawkins) on keybase.
* I have a public key whose fingerprint is 3784 426A 0D10 E571 C6BE 7DA8 DE51 E041 E3D9 CA9E
To claim this, I am signing this object: