Skip to content

Instantly share code, notes, and snippets.

@kharysharpe
kharysharpe / README.md
Created October 4, 2020 02:01
Hourly and Daily MYSQL Backup / Dump with Retention Period

Steps

Create directories

mkdir -p /backup/mysql/hourly
mkdir -p /backup/mysql/daily

Set permissions on scripts:

DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@kharysharpe
kharysharpe / DimDate.sql
Created May 3, 2020 01:38 — forked from sfrechette/DimDate.sql
Create and populate DimDate Table...
create table dbo.DimDate
(
DateKey int not null,
FullDate date not null,
DayNumberOfWeek tinyint not null,
DayNameOfWeek nvarchar(10) not null,
WeekDayType nvarchar(7) not null,
DayNumberOfMonth tinyint not null,
DayNumberOfYear smallint not null,
WeekNumberOfYear tinyint not null,
@kharysharpe
kharysharpe / custom-queries.php
Created January 31, 2020 12:39 — forked from carlodaniele/custom-queries.php
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
<?php
/**
* @package Custom_queries
* @version 1.0
*/
/*
Plugin Name: Custom queries
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@kharysharpe
kharysharpe / gist:1f3a216d868cfe4c6aad1c04850df448
Created October 22, 2019 17:56 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@kharysharpe
kharysharpe / print_with_win32print.py
Created September 16, 2019 03:10 — forked from buptxge/print_with_win32print.py
Print image using win32print and PIL
import win32print
import win32ui
from PIL import Image, ImageWin
PHYSICALWIDTH = 110
PHYSICALHEIGHT = 111
printer_name = win32print.GetDefaultPrinter ()
file_name = "new.jpg"
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# You can specify a custom docker image from Docker Hub as your build environment.
# run composer check-platform-reqs for a list of required extensions.
image: php:7.2-fpm
pipelines:
default:
# Not needed unless you're doing feature tests.
# - step:
@kharysharpe
kharysharpe / GetCardSwipe.js
Created August 12, 2019 12:55 — forked from marothstein/GetCardSwipe.js
Basic implementation of methods needed to receive swiped credit card data with javascript.
/*
* Basic implementation of methods needed to receive swiped credit card data with javascript.
*
* NOTE: PCI compliance specifies that card data must never be stored in an unencrypted manner, and
* only certain pieces of card data can be stored persistently. Ensure that output logging is NOT
* stored persistently when using this file, as it contains console.log messages that are intended
* to educate the user, and these messages contain data that may compromise your PCI compliance posture.
*
* If you choose to use any of this code with real credit card data, it is your responsibility
* to remove all log statements, output, or other code that may serve to persist offending information.
@kharysharpe
kharysharpe / v-cloak.md
Created January 2, 2019 00:43 — forked from adamwathan/v-cloak.md
Useful CSS utilities for Vue.js cloaking

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->