Skip to content

Instantly share code, notes, and snippets.

View tfirdaus's full-sized avatar
👨‍💻

Thoriq Firdaus tfirdaus

👨‍💻
View GitHub Profile
@tfirdaus
tfirdaus / email-regex-rfc6531.md
Created July 23, 2023 03:39 — forked from baker-ling/email_regex_rfc6531.md
Email Regex (RFC 6531)
@tfirdaus
tfirdaus / 1-setup.md
Created June 30, 2021 15:13 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@tfirdaus
tfirdaus / decrypt.php
Created April 21, 2021 13:42 — forked from ivankristianto/decrypt.php
Encrypt & Decrypt with PHP
<?php
/**
* Decrypts a value.
*
* If a user-based key is set, that key is used. Otherwise the default key is used.
*
* @since 1.0.0
*
* @param string $raw_value Value to decrypt.
* @param string $key Key to use for encryption.
@tfirdaus
tfirdaus / other.php
Created April 9, 2020 13:12 — forked from hakre/other.php
inject php declare ticks poc
<?php
/**
* just some file
*/
$a = 1;
if ($a > 0) {
$a += 2;
print($a);
@tfirdaus
tfirdaus / wp-cli-convert-to-innodb.sh
Created October 26, 2018 11:07
Convert MyISAM tables to InnoDB with WP-CLI
#!/usr/bin/env bash
# Author Mike https://guides.wp-bullet.com
# Purpose - Convert MyISAM tables to InnoDB with WP-CLI
# create array of MyISAM tables
WPTABLES=($(wp db query "SHOW TABLE STATUS WHERE Engine = 'MyISAM'" --silent --skip-column-names | awk '{ print $1}'))
# loop through array and alter tables
for WPTABLE in ${WPTABLES[@]}
do
@tfirdaus
tfirdaus / docker-useful-commands.md
Last active December 30, 2017 12:35 — forked from ngpestelos/remove-docker-containers.md
A collection of handy Docker CLI

Delete all containers

docker ps -q -a | xargs docker rm

-q prints only the container IDs -a prints all containers

@tfirdaus
tfirdaus / invert.js
Created June 14, 2017 21:45 — forked from sofish/invert.js
invert binary tree
function invert(tree) {
if (!tree instanceof Array || tree.length === 1) return tree;
var ret = [];
var inverted = tree.reverse();
for(var cur in inverted) {
if(!inverted.hasOwnProperty(cur)) continue;
ret.push(inverted[cur] instanceof Array ? invert(inverted[cur]) : inverted[cur]);
}
@tfirdaus
tfirdaus / wp-mysql-optimizations.sql
Last active October 26, 2018 11:06 — forked from boogah/wp_mysql_optimizations.sql
Common database optimizations for WordPress sites.
/* Delete revisions */
DELETE FROM wp_posts WHERE post_type = "revision";
/* Only use this if you no longer care about any of your current revisions! */
/* Delete trashed posts */
DELETE FROM wp_posts WHERE post_type = "trash";
/* Delete Jetpack Feedback Spam */
SELECT * FROM wp_posts WHERE wp_posts.post_type = "feedback" AND wp_posts.post_status= "spam";
@tfirdaus
tfirdaus / autoload.php
Created October 18, 2016 10:11 — forked from santerref/autoload.php
WordPress autoloader that respects PHP coding standards for plugin.
<?php
spl_autoload_register( function ( $class ) {
// project-specific namespace prefix
$prefix = 'my_plugin\\';
// base directory for the namespace prefix
$base_dir = __DIR__ . '/includes/';
# Upstream to abstract backend connection(s) for php
upstream php {
server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9000;
}
server {
server_name example.com;
root /var/www;