Skip to content

Instantly share code, notes, and snippets.

View marcopgordillo's full-sized avatar
💼
working

Marco Gordillo marcopgordillo

💼
working
View GitHub Profile
@marcopgordillo
marcopgordillo / wp-bootstrap4.4-pagination.php
Created December 16, 2020 12:46 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
@marcopgordillo
marcopgordillo / URItoBlobImage
Created September 25, 2020 17:41
URI to Blob Image function
function dataURItoBlob(dataURI) {
// convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
var byteString = atob(dataURI.split(',')[1]);
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
// write the bytes of the string to an ArrayBuffer
var ab = new ArrayBuffer(byteString.length);
@marcopgordillo
marcopgordillo / mysql-docker.sh
Created May 29, 2020 02:32 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql 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
docker run --rm -d -p 8080:8080/tcp -e PORT=8080 $(docker build -q .)
curl -s http://169.254.169.254/latest/meta-data/public-ipv4
curl -s http://169.254.169.254/latest/meta-data/mac
curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/12:c1:2b:7c:ea:d9/security-group-ids
http://checkip.amazonaws.com/
aws ec2 authorize-security-group-ingress --group-id sg-02351687a9ab7c5ec --port 8080 --protocol tcp --cidr 24.98.171.4/32
<div class="mx-auto">
<label class="sr-only" for="subscribe"> Your Email (required)</label>
[email* your-email id:subscribe class:form-control class:flex-fill class:mr-0 class:mr-sm-2 class:mb-3 class:mb-sm-0 placeholder "Enter email address..."]
[submit class:btn class:btn-primary "Subscribe"]</div>
[contact-form-7 id="10" title="Contact form" html_id="" html_class="container"]
<div class="form-group">
@marcopgordillo
marcopgordillo / virt-install
Created October 23, 2019 05:20
Install console kvm virt-install
sudo virt-install \
--name mariadb \
--ram 1024 \
--boot uefi \
--disk path=/dev/zvol/zpool-kvm/mariadb,bus=virtio,cache=unsafe,io=threads \
--vcpus 2 \
--os-type linux \
--os-variant debian10 \
--network bridge=virbr0,model=virtio \
--graphics none \