Skip to content

Instantly share code, notes, and snippets.

@kezenwa
kezenwa / Why WhatsApp Will Never Be Secure.md
Created July 8, 2022 18:22
Why WhatsApp Will Never Be Secure
@kezenwa
kezenwa / optimag.sh
Created April 19, 2022 14:41 — forked from TomaszGasior/optimag.sh
Optimize JPEG, PNG and SVG images with one simple command.
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
get_file_mime_type()
{
local filename=$1
file -b --mime-type "$filename"
}
@kezenwa
kezenwa / Cookies.js
Created November 6, 2021 22:15 — forked from fercarvo/Cookies.js
Pure Javascript Cookies Management
class Cookies {
static get (name) {
if (document.cookie.length === 0)
return null;
var c_start = document.cookie.indexOf(`${name}=`);
if (c_start === -1)
return null;
c_start = c_start + name.length + 1;
/*jslint continue:true*/
/**
* Adapted from {@link http://www.bulgaria-web-developers.com/projects/javascript/serialize/}
* Changes:
* Ensures proper URL encoding of name as well as value
* Preserves element order
* XHTML and JSLint-friendly
* Disallows disabled form elements and reset buttons as per HTML4 [successful controls]{@link http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2}
* (as used in jQuery). Note: This does not serialize <object>
* elements (even those without a declare attribute) or
@kezenwa
kezenwa / Query
Created February 22, 2021 04:33 — forked from lukecav/Query
MySQL script to get all WooCommerce orders including metadata
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,