Skip to content

Instantly share code, notes, and snippets.

View ajatoledo's full-sized avatar

Alex Aguilar ajatoledo

View GitHub Profile
@ajatoledo
ajatoledo / camera_stream_config
Last active April 30, 2023 22:21
Bash script to configure MainFormat and ExtraFormat streams for Amcrest Cameras; requires curl, URI encode any special characters, e.g. `[` and `]`; review Amcrest API documentation for further options
#!/usr/bin/env bash
# Define default configuration settings
Stream="ExtraFormat"
# Alert message
alert=$(printf "%10s\n""\n Usage: $0 offers the following arguments:\n
-i, --ip camera_ip, REQUIRED (string)
-u, --username camera_username, REQUIRED (string)
-p, --password camera_password, REQUIRED (string)
@ajatoledo
ajatoledo / octofarm_macos.md
Last active August 10, 2020 08:39
Outlines process for installing octofarm on macOS.

Notes:

  • Below are the steps used to install OctoFarm in macOS using Homebrew.

  • This was tested on macOS Mojave, 10.14.6. It should work on newer versions; however, I haven't confirmed whether this works.

Steps to Install

#!/bin/bash
# this is run within the directory from which the script is executed and relies upon the csv file titled 'index.csv'
# note in the oldname to newname process, bash on mac introduces /r (carriage return) chacters within the csv,
# therefore a step variable is added that overcomes the rename issue
while read line
do
oldName=${line%,*}
step=${line#*,}
newName=${step%$'\r'}
@ajatoledo
ajatoledo / proper_name_formatting.R
Created October 25, 2017 03:20
This is a simply function that can be called to format a vector of first name, middle name, surname vectors. Note that this does NOT account for any surnames that required lowercase first letters for proper formatting.
proper_name_formatting <- function(x) {
y <- strsplit(x, " ")[[1]]
paste(toupper(substring(y, 1,1)), substring(y, 2),
sep="", collapse=" ")
}
# below is an example for how to use the function
# usages is sapply(x, proper_name_formatting)
# hello_world <- c("hello world)
# sapply(hello_world, proper_name_formatting) -> Hello World