Skip to content

Instantly share code, notes, and snippets.

View ptasker's full-sized avatar
:fishsticks:
Fishsticks FTW

Peter Tasker ptasker

:fishsticks:
Fishsticks FTW
View GitHub Profile
@ptasker
ptasker / main.tf
Created April 4, 2025 17:20
Terraform Azure config - demo
# Configure the Azure provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0.2"
}
}
required_version = ">= 1.1.0"
@ptasker
ptasker / pdns-setup.sh
Last active February 10, 2025 21:01
PowerDNS setup
#!/bin/bash
set -e # Exit on error
# disable resolved
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
echo "Updating system packages..."
sudo apt update && sudo apt install -y curl gnupg lsb-release sqlite3
@ptasker
ptasker / redis.md
Last active April 27, 2023 14:35
Redis commands

Get all keys

keys *

Get all data for key

XRANGE "kl:stream:github.actions.v0.JobCanceledEvent:0" - +

Delete event/value at key

<?php
/**
* Returns uploads info for given subsite or primary site.
*
* @param int $blog_id Optional, defaults to primary.
*
* @return array
*
* NOTE: Must be run from primary site.
@ptasker
ptasker / rules.php
Created January 18, 2019 19:57
Wordfence firewall rules
<?php
if ( ! defined( 'WFWAF_VERSION' ) ) {
exit( 'Access denied' );
}
/*
This file is generated automatically. Any changes made will be lost.
*/
$this->failScores['sqli'] = 100;
$this->failScores['xss'] = 100;
@ptasker
ptasker / shelljs.js
Created November 29, 2017 19:19
Shell JS example
const shell = require( 'shelljs' );
shell.echo(
shell.cat('./src/wp-migrate-db-pro/wp-migrate-db-pro.php').grep( /.*\['version'] = '(.*)';/ )
.replace(/.*\['version'] = |'|;|\./g, '')
);
@ptasker
ptasker / backtick-function.js
Created November 23, 2017 18:48
Invoke function with backticks
const myfunc = () {
console.log('WAT');
}
myfunc``
// WAT
@ptasker
ptasker / kickvalet.sh
Created November 15, 2017 19:44
Kick Valet
#!/bin/sh
sudo brew services stop nginx
sudo brew services stop php71
sudo brew services stop dnsmasq
sudo brew services stop mysql
sudo brew services start nginx
sudo brew services start php71
sudo brew services start dnsmasq
sudo brew services start mysql
@ptasker
ptasker / zip-test.php
Created July 20, 2017 18:26
PHP Zip times
<?php
$PATH = '/your/folder/path';
//ZipArchive
//Test 1
$time_start = microtime( true );
@ptasker
ptasker / curl-test.php
Created July 20, 2017 13:50
Test PHP cURL connections to the DBI API
<?php
$url = 'https://api.deliciousbrains.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
$result = curl_exec($ch);
curl_close($ch);