Skip to content

Instantly share code, notes, and snippets.

View JSONOrona's full-sized avatar

Jason Orona JSONOrona

View GitHub Profile
#!/bin/bash
# Directory setup
mkdir -p /opt/eed/current
mkdir -p /opt/eed/factory
# Creating and configuring each service script
for i in {00..04}; do
# Create script file
SCRIPT_PATH="/opt/eed/factory/eed-savi-app-$i.sh"
#!/bin/bash
# Define user, groups, and background image path
user="savi"
groups="powerusers,wheel" # Groups to which the user will be added
background_image="/usr/share/backgrounds/background.bmp" # Path to the background image
# Check if user exists, if not create the user
if ! id "$user" &>/dev/null; then
echo "User $user does not exist. Creating user..."
@JSONOrona
JSONOrona / update_hostname.sh
Created April 23, 2024 16:59
update hostname
#!/bin/bash
# Ensures the script is run with root privileges
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Checks for the required argument
if [ $# -ne 1 ]; then
@JSONOrona
JSONOrona / add_user.sh
Created April 23, 2024 16:53
Add sudo user in ubuntu
#!/bin/bash
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Check for required argument
if [ $# -ne 2 ]; then
@JSONOrona
JSONOrona / kiosk-test.sh
Created April 23, 2024 16:50
Minimal Kiosk Desktop
#!/bin/bash
# Ensure the script is run as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Variables
USER_NAME="your_username" # CHANGE this to the username you wish to auto-login
@JSONOrona
JSONOrona / gist:6d43bc377e21de44c8104e88a2cda371
Created February 28, 2024 15:18
Structured Guide on Learning Embedded Linux
### 1. Linux Kernel Architecture
- **What to Learn:** Understanding the Linux kernel's architecture is crucial. Focus on how the kernel manages processes, memory, file systems, and hardware peripherals.
- **Resources:**
- _Linux Kernel Development_ by Robert Love for a solid foundation.
- The Linux Kernel documentation, especially the `Documentation/` directory in the Linux source code, for in-depth technical details.
### 2. Cross-Compilation and Toolchains
- **What to Learn:** Master the art of cross-compiling the Linux kernel and applications, which involves building software on one machine to run on another architecture.
- **Resources:**
- Tutorials on using Buildroot or the Yocto Project, which simplify the cross-compilation process.

This is simple RESTful API for managing a list of notes. We'll use the gorilla/mux package to handle routing and create endpoints for creating, retrieving, updating, and deleting notes. And, yes it does work!

  1. Setting Up Your Project:

Create a new directory for the project and navigate to it:

mkdir note-api
cd note-api
curl -X POST \
-H "Content-Type: application/json" \
-H "api-token: YOUR_API_TOKEN" \
-d '{
"name": "LDAP_USERNAME",
"email": "LDAP_EMAIL",
"password": "",
"authentication_type": "ldap",
"role_names": [
"ROLE_NAME_1",
require 'chef/server_api'
require 'openssl'
# Set the Chef Infra Server API endpoint and credentials
server_url = 'https://chef-server.example.com/organizations/myorg'
client_name = 'myclient'
client_key = '/path/to/myclient.pem'
# Set the SSL verification mode based on an environment variable
ssl_verify_mode = if ENV['CHEF_IGNORE_SSL_CERTIFICATE_VALIDATION'] == 'true'
@JSONOrona
JSONOrona / chef-api.rb
Created March 7, 2023 16:36
Ruby Chef API example
require 'chef'
require 'chef/config'
require 'chef/server_api'
# Configure the Chef Infra Server API endpoint and credentials
Chef::Config.node_name = 'yourusername'
Chef::Config.client_key = '/path/to/your/client/key.pem'
Chef::Config.chef_server_url = 'https://yourchefserver.com/organizations/yourorg'
# Define the name and password of the user to create