Skip to content

Instantly share code, notes, and snippets.

View rbcmgs's full-sized avatar

Brandon Cummings rbcmgs

View GitHub Profile
@rbcmgs
rbcmgs / gist:a0e51f0b5b9bace6529bfb77384dfe92
Created December 12, 2024 20:48 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@rbcmgs
rbcmgs / install_node_nvm_ubuntu.sh
Last active May 7, 2024 14:59
A Bash script to automate the installation of Node.js and Node Version Manager (NVM) on an Ubuntu machine. This script simplifies the setup process for Node.js development environments.
#!/bin/bash
# Script to install NVM (Node Version Manager), Node.js, and NPM on Ubuntu
echo "Starting installation of NVM, Node.js, and NPM on Ubuntu 22.04..."
# Check that the user is not running as root
if [ "$(id -u)" -eq 0 ]; then
echo "This script should not be run as root or with sudo."
exit 1
@rbcmgs
rbcmgs / clone_gist_flat_parameterized.sh
Last active May 1, 2024 18:25
A bash script that accepts an HTTPS URL of a GitHub GIST as a command-line argument and clones the gist into the current directory without creating nested directories. Suitable for automatic or batch gist cloning tasks when you want all your scripts to be located inside one directory.
#!/bin/bash
# This script clones a GitHub gist specified by a URL provided as an argument.
# It then makes any cloned shell scripts executable and moves all files to the current directory, avoiding a nested directory structure.
# Check for correct number of arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <gist-clone-url>"
exit 1
fi
@rbcmgs
rbcmgs / setup_mongodb_container.sh
Last active May 3, 2024 03:57
A Bash script to automate the setup of MongoDB within a Docker container on systems supporting Docker. This script handles the creation of a data directory, pulling the MongoDB image from Docker Hub, and running the MongoDB container. It supports optional command-line input to configure the container for either local-only or external network con…
#!/bin/bash
# Usage:
# - Without arguments: Follow prompts during execution.
# - With arguments: Specify `local` for local-only access or `external` for external access.
# Example: sudo ./setup-mongodb-container.sh local
# Alert user about the root privileges requirement.
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run with sudo or as root."
@rbcmgs
rbcmgs / install_docker_ubuntu.sh
Last active May 1, 2024 18:07
Bash script to automate the installation of Docker CE on Ubuntu systems. The script ensures that all necessary prerequisites are met and sets up Docker to run as a service, automatically starting at boot. It also adds the current user to the Docker group to allow running Docker commands without `sudo`.
#!/bin/bash
# This script is intended for Ubuntu distributions to automate the Docker installation.
#
# Additional Setup Instructions:
# 1. Save the script as `install-docker-ubuntu.sh`.
# 2. Make the script executable with the command: `chmod +x install-docker-ubuntu.sh`.
# 3. Run the script using `sudo ./install-docker-ubuntu.sh`.
# 4. After the installation, log out and log back into your system to ensure that group changes take effect. This is required to run Docker commands without `sudo`.
@rbcmgs
rbcmgs / python_enum_speed_test.py
Last active May 1, 2024 18:08
A Python script to measure the time it takes to enumerate and print numbers from 0 to 10,000. Useful for comparing enumeration speeds across different Python versions.
#!/usr/bin/env python3
import timeit
def enumeration():
""" Enumerates numbers from 0 to 10,000 and prints each number. """
for i in range(10001):
print(i)
# Time the execution of the enumeration function over 10 iterations.
execution_time = timeit.timeit(enumeration, number=10)
@rbcmgs
rbcmgs / Elasticsearch_Index_Management_Cheat_Sheet.md
Created April 5, 2024 22:03
This document provides a concise cheat sheet for basic index management commands tailored for use within the Kibana Dev Tools console, facilitating common tasks in Elasticsearch clusters such as cluster health checks, index creation, modification, deletion, and more. These commands cover essential maintenance and operational tasks, making them i…

1. Check Cluster Health

This command retrieves the health status of your Elasticsearch cluster, indicating its operational state with a color code (green, yellow, or red).

GET /_cluster/health

2. List All Indices

To view a list of all indices currently present in your Elasticsearch cluster, including their health, status, and primary and replica shard counts.

GET /_cat/indices?v
@rbcmgs
rbcmgs / listCombineDedup.py
Created September 15, 2022 18:47
python combine two lists and deduplicate
a = [1, 2, 2, 3, 6, 5]
b = [2, 5, 7, 9, 6, 13]
list(set(a + b))
@rbcmgs
rbcmgs / mongooseReturnSelectiveFields.js
Created September 15, 2022 17:16
javascript mongoose return fields selectively
const User = require("./model/User");
// Return documents excluding fields
const excluding = await User
.find()
.select("-pass -salt");
console.log("Data excluding fields:", excluding);
// Return documents including fields
const including = await User
@rbcmgs
rbcmgs / findAllCharCombos.js
Created September 15, 2022 15:06
javascript find all character combinations
function combinations(str) {
var fn = function(active, rest, a) {
if (!active && !rest)
return;
if (!rest) {
a.push(active);
} else {
fn(active + rest[0], rest.slice(1), a);
fn(active, rest.slice(1), a);
}