Skip to content

Instantly share code, notes, and snippets.

View JustGAST's full-sized avatar

Alexey Rozhnov JustGAST

View GitHub Profile
@JustGAST
JustGAST / cloud_mail_folder_size.js
Created March 15, 2021 16:40
Get cloud.mail.ru folder sum size
// ==UserScript==
// @name cloud.mail.ru folder size sum
// @description Shows folder sum size in Mb for russian locale
// @match *://cloud.mail.*
// ==/UserScript==
const getSizeInMb = (size) => {
switch (true) {
case size.includes('МБ'):
return parseFloat(size.substring(0, size.length - 3));
@JustGAST
JustGAST / mysql_get_tables_size.sql
Created December 17, 2019 11:54
Gets tables size in MySQL database
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
ORDER BY (data_length + index_length) DESC;
@JustGAST
JustGAST / docker_mysql_dump.sh
Last active May 22, 2024 10:16
Commands to backup and restore database from/to docker container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
# Backup to gzip
pg_dump db_name | gzip > dump_name.sql.gz
# Restore from gzip
@JustGAST
JustGAST / raindropIoRemoveEmptyCollections.js
Last active May 22, 2024 10:16
Raindrop.io remove all empty collections. (Because raindrop have no ability to select multiple collections to delete them). Run in console on page app.raindrop.io
var elems = document.getElementsByClassName('collection');
for (let idx in elems) {
var elem = elems[idx];
var countElem = elem.querySelector('.count');
if (countElem.textContent !== "") {
continue;
}
var actionsElem = elem.querySelector('.actions');