Skip to content

Instantly share code, notes, and snippets.

View altimmons's full-sized avatar

Andy Timmons altimmons

  • CLT
View GitHub Profile
#!/bin/bash
cat<<EOF
###############################################################################
# Byobu f-key keybindings
# This configuration profile is intended to provide a useful
# keybindings using the keyboard's f-keys
#
# Copyright (C) 2008 Nick Barcet <nick.barcet@canonical.com>
# Dustin Kirkland <kirkland@canonical.com>
@altimmons
altimmons / securetty
Created April 1, 2021 02:56
drop in replacement for missing /etc/securetty file
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
# File missing from Debian 20.04+ perms should be
# sudo chmod 644 securetty rw/r/r/q
console
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
@altimmons
altimmons / securetty
Created April 1, 2021 02:52
drop in replacement for missing /etc/securetty file
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
# File missing from Debian 20.04+
console
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
:0.0
@altimmons
altimmons / .\Make-Shim.ps1
Created March 31, 2021 02:46
A powershell script (which can be installed as a module) to create a Shim (from Chocolatey, requires Chocolatey) into the C:\ProgramData\Chocolatey\bin directory. This directory should be added to path, basically, this script links anything application to path, without making the path search depth excessively deep.

function Make-Shim{
<#
.SYNOPSIS
Creates a shim (or batch redirect) for a file that is on the PATH.
Makes a shim in ProgramData/choco/bin to add an exe to path
.DESCRIPTION
@altimmons
altimmons / TryandCatchEverything
Last active September 15, 2019 05:54
Expects a String fileName
try {
//code
}catch(FileNotFoundException fnfE){
App.log.warning( "FileNotFoundException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( fnfE.getStackTrace() ) );
}catch( IOException ioE ){
App.log.warning( "IO Exception trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( ioE.getStackTrace() ) );
/**
* A handler for printing stack traces in the Log, which doesn't like pure
* stack traces, just string elements. I am sure there is an easier way.
*
* @param ste - the stack trace element.
* @return A formatted string of the last [STACK_TRACE_LEN] stack trace
* elements.
*/
public static String stackTraceConv( StackTraceElement[] ste ){
StringBuilder sb = new StringBuilder();
@altimmons
altimmons / FileNameIterator
Created September 15, 2019 05:44
Iterates a filename
/**
* Rather unneccessary, but delightfully interesting (and efficient) way to
* iterate the number at the end of a file name. At least I expect it to be
* efficient since it utilizes a single character buffer all the way through.
*
* It does this by using, underneath everything, javas fast array copy methods
* via StringBuilder, and then through slicing and reversing the string to
* abstract out the number at the end of a fileName. So a File Name of the
* format FileName1234.txt will automatically be parsed and return
* FileName1235.txt.
/**
* Generates a string the length of the argument of Random Characters from
* a set of given characters. Returns the String.
* <p>
* The string in the method from which characters are chosen can be edited to
* add characters and other special symbols.
*
* @param length - the number of Random characters to return.
* @return
*/
double x1 = 1.0, x2 = 10.0; //or float x1 = 1.0f, x2 =2.0f
double f = Math.random()/Math.nextDown(1.0);
double x = x1*(1.0 - f) + x2*f;
//test code
int c = 0;
while(c< 20) {
float x1 = 1.0f, x2 = 10.0f;
double f = Math.random() / Math.nextDown( 1.0 );
this is a test