Skip to content

Instantly share code, notes, and snippets.

View SeinopSys's full-sized avatar
🕶️
Dealing With It

David Joseph Guzsik SeinopSys

🕶️
Dealing With It
View GitHub Profile
@SeinopSys
SeinopSys / reloadInSeconds.js
Last active March 6, 2023 14:11
Reload a browser tab in the nearest X seconds
(function reloadInSeconds () {
const s = parseInt(prompt('Reload in nearest Nth second, where N is:'), 10);
if (isNaN(s)) return;
const ms = s * 1e3;
const now = Date.now();
const reloadAtTs = (Math.ceil(now / ms) + 1) * ms;
console.info('Reloading at', new Date(reloadAtTs).toLocaleString());
const countdownTick = () => {
const timeleft = reloadAtTs - Date.now();
const reloadInRounded = Math.round(timeleft/1e3);
@SeinopSys
SeinopSys / mix.js
Created March 20, 2021 22:58
JavaScrip hex color mix function
const mix = (hex1, hex2, percent) => {
const breakup = (hex) => hex.match(/[a-f0-d]{2}/ig).map(n => parseInt(n, 16));
const rgb1 = breakup(hex1);
const rgb2 = breakup(hex2);
const mixed = rgb1.map((c, i) => Math.round((c * (1 - percent)) + (rgb2[i] * percent)).toString(16));
return '#'+mixed.map(s => s.length < 2 ? '0'+s : s).join('');
};
console.log(mix('#000000','#ffffff', .2));
@SeinopSys
SeinopSys / example.puml
Created August 29, 2018 07:40 — forked from QuantumGhost/example.puml
A simple template for PlantUML to draw ER diagram. The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@SeinopSys
SeinopSys / dvp.user.css
Last active April 2, 2017 13:31
Derpibooru voting ponies userstyle
@-moz-document url-prefix("https://derpibooru.org"), url-prefix("https://trixiebooru.org") {
.interaction--fave .fa,
.interaction--upvote .fa,
.interaction--downvote .fa,
.interaction--comments .fa {
color: transparent;
background-image: url("https://derpicdn.net/img/view/2017/4/1/1401039.svg");
display: inline-block;
background-size: 64px 64px;
width: 32px;
@SeinopSys
SeinopSys / code.js
Last active August 22, 2017 13:58
DeviantArt comment timestamp parser + userscript
function parseCommentDate(el){
var _months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Nov','Dec'],
_pad = function(n){return n<10?'0'+n:n},
time = el.title.replace(/^.*\(at (\d{1,2}):(\d{1,2}):(\d{1,2}) ([AP]M)\)$/, function(_,h,m,s,ampm){
if (ampm === 'PM'){
h = parseInt(h,10)+12;
if (h >= 24)
h -= 24;
}
else if (ampm === 'AM' && h == 12) h = 0;
@SeinopSys
SeinopSys / pma-update.sh
Last active March 17, 2022 20:19
Bash script file for updating phpMyAdmin
#!/bin/bash
# <Config>
backuppath="/path/to/backups"
pmapath="/path/to/phpMyAdmin"
# </Config>
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@SeinopSys
SeinopSys / dA Correspondence Cleaner
Last active August 29, 2015 14:00
deviantArt Correspondence Message Cleaner
(function(pageStepDelay,screwComments){
var halfStepDelay = pageStepDelay / 2;
if (!/\.deviantart\.com$/.test(window.location.host) || !/^\/notifications\/?$/.test(window.location.pathname))
return false;
function notify(message,visibleForMS,callback){
console.log(message);
if (visibleForMS !== false) visibleForMS = typeof visibleForMS === 'number' ? visibleForMS : 3000;