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

#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 / 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 / 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
@hmcclungiii
hmcclungiii / dbo.Country.sql
Created November 13, 2016 05:43
MS SQL dump of countries along with their ISO codes, phone codes, and other related information. I took this from http://www.infomazing.net/blog/database-country-table-with-sql-insert-statements
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Country](
@hmcclungiii
hmcclungiii / wp_terms-states.sql
Last active March 6, 2016 21:28
An SQL Query to Add the 50 US States into the Wordpress wp_terms (Categories) Table
INSERT INTO `wp_terms`(`name`, `slug`, `term_group`) VALUES
('AK - Alaska', 'ak', 0),
('AZ - Arizona', 'az', 0),
('AR - Arkansas', 'ar', 0),
('CA - California', 'ca', 0),
('CO - Colorado', 'co', 0),
('CT - Connecticut','ct', 0),
('DE - Delaware','de', 0),
('FL - Florida','fl', 0),
('GA - Georgia','ga', 0),
@hmcclungiii
hmcclungiii / states.sql
Last active March 6, 2016 20:27 — forked from JeremyMorgan/states.sql
An SQL Query to insert 50 U.S. States into a database.Make sure your auto increment is set in MySQL, and Identity_insert is set in MS-SQL.
CREATE TABLE [state](
[stateID] [int] IDENTITY(1,1) NOT NULL,
[stateCode] [nchar](2) NOT NULL,
[stateName] [nvarchar](128) NOT NULL,
CONSTRAINT [PK_state] PRIMARY KEY CLUSTERED
( [stateID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY])
ON [PRIMARY]