Skip to content

Instantly share code, notes, and snippets.

View hmcclungiii's full-sized avatar
👨‍💻
Available for Hire

Houston McClung hmcclungiii

👨‍💻
Available for Hire
View GitHub Profile
@hmcclungiii
hmcclungiii / get_script_path.sh
Created September 15, 2023 23:52
Get Path of Script
SCRIPT_DIR="$(dirname $(realpath "${BASH_SOURCE[0]:-$0}"))"
@hmcclungiii
hmcclungiii / non_interactive_exit.sh
Created September 15, 2023 23:51
If not running interactively, exit
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
@hmcclungiii
hmcclungiii / FileHandler.cs
Last active October 12, 2022 05:26
Code template/model for (de)serializing an object to/from an XML file.
using System;
using System.ComponentModel;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace XmlFile
{
@hmcclungiii
hmcclungiii / AlternatingExcelRows
Created July 27, 2014 04:17
To alternate row colors in Excel ...
Select a range of cells to format ...
Click Conditional Formatting - Click New Rule
For the rule, enter this ...
=MOD(ROW(),2)=1
Click the format button and select your formatting.
Click OK twice and there you go!
@hmcclungiii
hmcclungiii / filename_with_exepath.cs
Created November 27, 2018 17:16
Filespec of file in the same directory as the current executable
private const string ConfigFile_Filename = "ENTER FILENAME HERE";
private string GetExePath()
{
return(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
}
private string GetFilespec()
{
return(System.IO.Path.Combine(GetExePath(), ConfigFile_Filename));
}
@hmcclungiii
hmcclungiii / browserwrapper.cs
Last active September 27, 2021 23:57
C# Webbrowser Wrapper Control, used to be able to wait until a page completely loads prior to taking action on it. For web automation projects.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
public partial class browserwrapper : System.Windows.Forms.WebBrowser
{

#Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux

If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.

The full error message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@hmcclungiii
hmcclungiii / Linux-Terminal-Users-CRUD.md
Last active January 5, 2020 19:32
Linux commands for working with users and groups in the terminal.

Important Files and Paths

  • /etc/login.defs is the configuration file for login parameters, containing some defaults that are used for the commands below.
  • /etc/adduser.conf contains the default configuration and settings for creating new users with adduser
  • The default files for new users is stored in /etc/skel, though this can be changed in /etc/adduser.conf
  • The user database is stored at /etc/passwd
  • User passwords are stored in /etc/shadow
  • Group info is stored at /etc/group

Find all users that login through the terminal.

sudo awk -F':' '$2 ~ "\\$" {print $1}' /etc/shadow

@hmcclungiii
hmcclungiii / install_minecraft
Created September 8, 2017 08:59
Commands to install Minecraft on Ubuntu 16.04
sudo add-apt-repository ppa:flexiondotorg/minecraft
sudo apt update
sudo apt install minecraft-installer