Skip to content

Instantly share code, notes, and snippets.

View cplpearce's full-sized avatar
🙃
Riding the programming emotional roller coaster

lorem ipsum cplpearce

🙃
Riding the programming emotional roller coaster
View GitHub Profile
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg unzip
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
@cplpearce
cplpearce / ATAK-UAS-RTSP-README.md
Created August 17, 2023 19:03 — forked from curtishall/ATAK-UAS-RTSP-README.md
rtsp-simple-server ATAK configuration (Linux)

Some users report having to comment out the following, your mileage may vary:

readBufferSize, runOnPublish, runOnPublishRestart, runOnRead, runOnReadRestart

ATAK users change the observer URL in UAS Tool to point to 554 (or whatever port you decide to use)

Download the latest rtsp-simple-server (0.17.13)

wget https://github.com/aler9/rtsp-simple-server/releases/download/v0.17.13/rtsp-simple-server_v0.17.13_linux_amd64.tar.gz
@cplpearce
cplpearce / country_codes
Created March 23, 2022 21:54
Country Codes with Bounding Box
{
"aw": {
"name": "Aruba",
"alpha-2": "AW",
"alpha-3": "ABW",
"country-code": "533",
"iso_3166-2": "ISO 3166-2:AW",
"region": "Americas",
"sub-region": "Latin America and the Caribbean",
"intermediate-region": "Caribbean",
@cplpearce
cplpearce / metadata_version_2
Created February 21, 2022 05:20
metadata_version_2
{
metadata: {
core: {
name: "ISR Coverage",
uid: "7c2f79e7-2653-4adb-9e18-270761b3a0b1",
version: 1,
type: "tool",
},
api: {
method: "post",
@cplpearce
cplpearce / kata16QueenThreatDetector.js
Created August 14, 2020 15:55
Kata 16 - Queen Threat Detector
let wQ = [0, 5];
let bQ = [5, 0];
let board = [
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
@cplpearce
cplpearce / kata15SquareCode.js
Created August 12, 2020 01:05
Kata 15 - Square Code
const squareCode = function(message) {
msg = message.replace(/ +/g, '');
let len = msg.length;
let sqR = Math.ceil(Math.sqrt(len));
let rS = [];
for (let r = 0; r < sqR; r++) {
for (let i = 0; i < sqR; i++) {
rS.push(msg[r + (i * sqR)])
}
rS.push(' ');
@cplpearce
cplpearce / kata14JsObjectFromUrlEncodedString.js
Created August 11, 2020 20:23
Kata 14 - JS Object From URL Encoded String
const urlDecode = function(text) {
text = text.replace(/%20/g, ' ');
let strArray = text.split(/[(=)|(&)]+/);
let results = {};
for (let i = 0; i < strArray.length; i += 2)
results[strArray[i]] = strArray[i + 1];
return results
};
console.log(urlDecode("duck=rubber"));
@cplpearce
cplpearce / kata13CaseMakerII.js
Created August 11, 2020 18:53
Kata 13 - Case Maker II
const makeCase = function (input, scheme) {
(typeof scheme !== 'object') && (scheme = [scheme]);
let arrStr = [input];
for (let sch of scheme){
let i = 0;
let cap = false;
for (let c of arrStr.join('')) {
if (sch === 'camel') {
c === ' ' ? cap = true : cap === true ? (arrStr[i] = c.toUpperCase()) && (cap = false) : arrStr[i] = c;
i++;
@cplpearce
cplpearce / kata12OrganizingInstructors.js
Created August 9, 2020 03:56
Kata 12 - Organizing Instructors
// In this exercise, we will be given a list of instructors and we will create a single object to organize them based on their course.
// Input
const organizeInstructors = function(instructors) {
let org = {};
for (const i of instructors) {
org[i.course] ? org[i.course].push(i.name) : org[i.course] = [i.name];
}
return org;
@cplpearce
cplpearce / kata11ChangeCalculator.js
Created August 9, 2020 03:09
Kata 11 - Change Calculator
const calculateChange = function(total, cash) {
// c(hange)
let c = {
twentyDollar : 0,
tenDollar : 0,
fiveDollar : 0,
twoDollar : 0,
oneDollar : 0,
quarter : 0,
dime : 0,