Skip to content

Instantly share code, notes, and snippets.

View DavidGarciaCat's full-sized avatar

David Garcia DavidGarciaCat

View GitHub Profile
{
"require": {
"mailgun/mailgun-php": "^2.4",
"php-http/curl-client": "^1.7",
"guzzlehttp/psr7": "^1.4"
}
}
-- Database
SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME
FROM information_schema.SCHEMATA
WHERE schema_name = "database_name";
-- Tables
SELECT DISTINCT TABLE_COLLATION, COLLATION_NAME, CHARACTER_SET_NAME
FROM information_schema.`TABLES` AS t
INNER JOIN information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` AS ccsa ON ccsa.collation_name = t.table_collation
AND t.table_schema = "database_name";
@DavidGarciaCat
DavidGarciaCat / calendar.twig
Created July 26, 2017 21:38 — forked from aknosis/calendar.twig
Table based calendar only using Twig
{#
time can be any string acceptable by http://www.php.net/strtotime, the
template will output that time's month.
If you don't want to pass in a date you can set time like this:
{% set time = "now"|date("U") %}
{% set time = "December 2012"|date("U") %}
How ever you want to output items onto the calendar is a different issue,
but I'd assume pushing everything into an array numerically indexed by that day:
@DavidGarciaCat
DavidGarciaCat / urlobject.js
Created March 30, 2017 10:25 — forked from aymanfarhat/urlobject.js
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@DavidGarciaCat
DavidGarciaCat / .bash_profile
Last active October 15, 2016 00:49 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@DavidGarciaCat
DavidGarciaCat / composer
Created October 13, 2016 15:04
Install composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
@DavidGarciaCat
DavidGarciaCat / fio-tests.sh
Created August 8, 2016 14:47
Flexible I/O tester - Disk IO performance inspector
#!/bin/sh
if [ ! -d /mnt/fio_test ]; then mkdir /mnt/fio_test; fi
for RUN in 1 2; do
rm -f /mnt/fio_test/*
fio --directory=/mnt/fio_test \
--name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G \
--numjobs=2 --time_based --runtime=180 --group_reporting --norandommap
sleep 5
#!/bin/bash
PO_TOKEN=""
PO_USER=""
PO_BIN=/usr/local/bin/pushover
ZB_TO=$1
ZB_SUBJECT=$2
ZB_BODY=$3
#!/bin/bash
#
# Program: SSL Certificate Check <ssl-cert-check>
#
# Source code home: http://prefetch.net/code/ssl-cert-check
#
# Documentation: http://prefetch.net/articles/checkcertificate.html
#
# Author: Matty < matty91 at gmail dot com >
#
@DavidGarciaCat
DavidGarciaCat / firewall.sh
Created January 28, 2016 10:14
GNU/Linux Firewall - Default rules
#!/bin/bash
# ****************************************************************
# IPTables path
# ****************************************************************
IPT=/sbin/iptables
# ****************************************************************
# Remove/Erase old rules