Skip to content

Instantly share code, notes, and snippets.

View MitsuhaKitsune's full-sized avatar
💭
I may be slow to respond.

Mitsuha Kitsune MitsuhaKitsune

💭
I may be slow to respond.
View GitHub Profile
@MitsuhaKitsune
MitsuhaKitsune / center_div_content.css
Last active September 25, 2021 21:23
Multiple ways to center horizontal/vertical content on div with CSS
div {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0 auto
}
div {
display: grid;
@MitsuhaKitsune
MitsuhaKitsune / batch_ocr.bat
Last active July 11, 2021 23:54
Batch parse of VideoSubFinder text images with tesseract (To extract hardcoded subtitles of videos)
@ECHO OFF
for %%f in (D:\VideoTools\VideoSubFinder\Release_x64\TXTImages\*.jpeg) do (
tesseract %%f D:\VideoTools\VideoSubFinder\Release_x64\TXTResults\%%~nf -l spa
)
@MitsuhaKitsune
MitsuhaKitsune / prestashop_cleanup.sql
Created December 3, 2018 06:32
Cleanup for prestashop database
DELETE FROM `ps_orders` WHERE `id_order` IN (0);
DELETE FROM `ps_order_carrier` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders` WHERE `id_order` IS NOT NULL);
DELETE FROM `ps_order_cart_rule` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders` WHERE `id_order` IS NOT NULL);
DELETE FROM `ps_order_detail` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders` WHERE `id_order` IS NOT NULL);
DELETE FROM `ps_order_detail_tax` WHERE `id_order_detail` NOT IN (SELECT `id_order_detail` FROM `ps_order_detail` WHERE `id_order_detail` IS NOT NULL);
DELETE FROM `ps_order_history` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders` WHERE `id_order` IS NOT NULL);
DELETE FROM `ps_order_invoice` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders` WHERE `id_order` IS NOT NULL);
@MitsuhaKitsune
MitsuhaKitsune / kue_cleanup.js
Created February 12, 2018 06:26 — forked from niravmehta/kue_cleanup.js
Cleanup script for Kue job queueing system in Node.js. Deletes failed, active and completed jobs after specified time. Can run on command line directly with "node kue_cleanup". Requires Kue installed :-)
var kue = require('kue'),
jobs = kue.createQueue(),
util = require('util'),
noop = function() {};
jobs.CLEANUP_MAX_FAILED_TIME = 30 * 24 * 60 * 60 * 1000; // 30 days
jobs.CLEANUP_MAX_ACTIVE_TIME = 1 * 24 * 60 * 60 * 1000; // 1 day
jobs.CLEANUP_MAX_COMPLETE_TIME = 5 * 24 * 60 * 60 * 1000; // 5 days
jobs.CLEANUP_INTERVAL = 5 * 60 * 1000; // 5 minutes
@MitsuhaKitsune
MitsuhaKitsune / models-locale.js
Created February 8, 2018 04:22 — forked from albertosouza/models-locale.js
Sails.js simple example of localization with database
module.exports = {
adapter:'exampleDB',
//tableName:'locale',
attributes: {
text: {
type: 'string'
},
// locale config
@MitsuhaKitsune
MitsuhaKitsune / models.js
Created January 19, 2018 14:16
Update or create helper for waterline on SailsJS
// Include this code on your config/models.js
updateOrCreate: function(criteria, values){
var self = this;
if (!values) values = criteria.where ? criteria.where : criteria;
return this.findOne(criteria).then(function (result){
if (result) {
return self.update(criteria, values);
} else {