Skip to content

Instantly share code, notes, and snippets.

@reidsneo
Last active September 11, 2025 09:42
Show Gist options
  • Select an option

  • Save reidsneo/36159b774bc539cc6a7d25c6ca8fbcbd to your computer and use it in GitHub Desktop.

Select an option

Save reidsneo/36159b774bc539cc6a7d25c6ca8fbcbd to your computer and use it in GitHub Desktop.
office project
6/12/2020, 09:06:32 Please be note cxx hotspot is missing due poller 1 disk is full, the normalize table is not updated 5-11 june
String.raw`let eventList;
function formatArrivalTimeStr(seconds) {
if (seconds < 60) {
return 'sec';
} else {
const minutes = Math.ceil(seconds / 60);
return 'min';
}
}
function formatArrivalTimeVal(seconds) {
if (seconds < 60) {
return seconds;
} else {
const minutes = Math.ceil(seconds / 60);
return minutes;
}
}
function start_sse() {
const evtSource = new EventSource("https://maestronic.net/sse.php");
evtSource.onmessage = function(event) {
console.log("Raw event:", event);
const newElement = document.createElement("li");
let text;
try {
const data = JSON.parse(event.data);
// Update journey-name-X and journey-arrival-X elements
if (Array.isArray(data)) {
data.forEach((item, idx) => {
const journeyNameEl = document.getElementById('journey-name-' + (idx + 1));
const journeyArrivalTimeEl = document.getElementById('journey-arrival-' + (idx + 1));
if (journeyNameEl) {
const nameP = journeyNameEl.querySelector('p');
if (nameP) {
// Detect old format: direct text or span, new format: span or marquee
const currentMarquee = nameP.querySelector('marquee');
const currentSpan = nameP.querySelector('span');
const newName = item.stop_name;
const isLongName = newName.length > 20;
if (currentMarquee) {
// Only update marquee if name changed
if (currentMarquee.textContent !== newName) {
currentMarquee.textContent = newName;
}
} else if (isLongName) {
// Create marquee if not exists
nameP.textContent = '';
const marquee = document.createElement('marquee');
marquee.textContent = newName;
marquee.style.display = 'block';
marquee.style.width = '100%';
marquee.setAttribute('scrollamount', '12');
marquee.setAttribute('loop', 'infinite');
marquee.setAttribute('behavior', 'scroll');
marquee.setAttribute('truespeed', '');
marquee.setAttribute('style', 'white-space:nowrap;');
marquee.innerHTML = '<span style="padding-right: 40px;">' + newName + '</span>';
nameP.appendChild(marquee);
} else {
// Display short names normally
if (currentSpan) {
currentSpan.textContent = newName;
} else {
nameP.textContent = newName;
}
}
}
}
if (journeyArrivalTimeEl) {
const arrivalP = journeyArrivalTimeEl.querySelector('p');
if (arrivalP) {
const firstSpan = arrivalP.querySelector('span');
const secondSpan = arrivalP.children[1];
const val = formatArrivalTimeVal(item.arrival_time);
const str = formatArrivalTimeStr(item.arrival_time);
if (firstSpan && secondSpan) {
firstSpan.textContent = val;
secondSpan.textContent = str;
} else if (firstSpan) {
firstSpan.textContent = val;
// If only one span, try to update nextSibling text
if (firstSpan.nextSibling && firstSpan.nextSibling.nodeType === Node.TEXT_NODE) {
firstSpan.nextSibling.textContent = str;
}
} else {
// Old format: direct text
arrivalP.textContent = '' + val + str;
}
}
}
});
text = "Updated journey names";
} else {
text = 'message: ' + (data.time || JSON.stringify(data));
}
} catch (e) {
// If not JSON, just show raw
text = 'message: ' + event.data;
}
newElement.textContent = text;
// eventList.appendChild(newElement);
};
evtSource.onerror = function(err) {
console.error("SSE error:", err);
};
}
document.addEventListener("DOMContentLoaded", function() {
// eventList = document.getElementById("list");
start_sse();
});
`
/opt/USERFILES/USR001/KeyDecrypt/privatekey.pem
/opt/USERFILES/USR001/Player/cam1/cam1.mp4
/opt/USERFILES/USR001/Player/cam2/cam1.mp4
0. init => baru mulai
1. collecting | listing | fetchlist => mungkin perlu waktu utk si daemon utk collecting / sorting resources mp4 mana aja yg mw dipake dalam proses decrypt nantinya
2. encoding => proses batch encoding file recording ke format playable mp4 file
4. merging | concating => proses merge file jadi single file dan concat yg belom 20 menit dengan black screen
5. formating | dashing => proses convert single file mp4 jadi DASH file format
6. finish | readyplay => state bahwa file sudah selesai diproses dan tinggal di play
init
processing
-> compile list recording
-> encoding file
encoding file a
encoding file b
encoding finished total 2 files in X second
-> concating file a b c d
concating camera 1 : file a + b + c
camera 1 concated 3 files
concat finish in X second (s)
concating camera 2 : file a + b + c + d
camera 2 concated 4 files
concat finish in 3 second
-> dashing
convert camera 1 to dash file...
convert finished in X second
finished
all task finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment