Skip to content

Instantly share code, notes, and snippets.

View GitKat's full-sized avatar
🎯
Focusing

GitKat

🎯
Focusing
View GitHub Profile
@GitKat
GitKat / JSConvert12to24Time.js
Created March 31, 2022 15:50 — forked from apolopena/JSConvert12to24Time.js
JavaScript: convert 12 hours time string to 24 hour time string
// NOTE: time string must look like this 07:05:45PM or this 07:05:45AM and account for 12:00:00AM and convert 12:00:00pm to 12:00:00
function timeConversion(s) {
const ampm = s.slice(-2);
const hours = Number(s.slice(0, 2));
let time = s.slice(0, -2);
if (ampm === 'AM') {
if (hours === 12) { // 12am edge-case
return time.replace(s.slice(0, 2), '00');
}
return time;
@GitKat
GitKat / my.cnf
Created July 20, 2019 10:02 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value