Skip to content

Instantly share code, notes, and snippets.

Guy Elsmore-Paddock GuyPaddock

Block or report user

Report or block GuyPaddock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@GuyPaddock
GuyPaddock / more_advanced_js.html
Last active Jan 18, 2020
Simple HTML + JS Examples
View more_advanced_js.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Slightly More Advanced Page</title>
</head>
<body>
<h1>A Slightly More Advanced Simple Page</h1>
<p id="my_paragraph"></p>
@GuyPaddock
GuyPaddock / results.txt
Created Dec 30, 2019
How array_merge() compares to the + operator when working with different array types
View results.txt
On PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ):
Result of combining:
Array
(
[0] => 1
[1] => 2
[2] => 3
)
...with:
@GuyPaddock
GuyPaddock / results.txt
Last active Dec 18, 2019
How array_reduce() and array_map() Behave with Associative Arrays in PHP
View results.txt
On PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ):
Array
(
[a] => ABC: 1
[b] => ABC: 2
)
,1,2
@GuyPaddock
GuyPaddock / results.txt
Last active Dec 18, 2019
How Static Variables Work with Inheritance in PHP
View results.txt
On PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ):
ClassA = 1576680836
ClassA = 1576680836
ClassA = 1576680838
ClassA = 1576680838
ClassA = 1576680840
ClassA = 1576680840
ClassX = 1576680842
@GuyPaddock
GuyPaddock / resurrect.php
Last active Sep 18, 2019
Resurrecting an Unsaved Drupal 8 Node from the Database using Devel
View resurrect.php
<?php
// NOTE: Node previews expire after 7 days. Be sure to use this method to extract the desired data before then.
// IMPORTANT: Set this to the user ID of the person who was creating/lost the node.
$user_id = 1;
// IMPORTANT: Set this to the UUID that appeared in the node preview URL.
// This value is from a URL that looked like this:
// https://my-site/node/preview/ed4eaac0-3c32-427e-860f-6ce8fc79c3b2/full
$preview_id = 'ed4eaac0-3c32-427e-860f-6ce8fc79c3b2';
@GuyPaddock
GuyPaddock / array_contains.sh
Created Jul 2, 2019
Check if a value is in an array in Bash
View array_contains.sh
##
# Determine if a given element exists in an array.
#
# Based on:
# https://stackoverflow.com/a/11525897/4342230
#
# @param string $1
# The value to look for (the "needle").
# @param string... $2...
# The array of values to search (the "haystack").
@GuyPaddock
GuyPaddock / instructions.md
Last active Jun 10, 2019
Creating default Windows Theme
View instructions.md

Introduction

This is a brief snippet for Windows 10 admins that want to make a Windows theme the default for new users without enforcing it via Group Policy.

Instructions

  1. Download and install the desired theme from the Windows Store (or create your own).
  2. Find the theme under %USERPROFILE%\AppData\Local\Microsoft\Windows\Themes\.
  3. Move .theme file to %SystemRoot%\Resources\Themes.
  4. Move backgrounds into %SystemRoot%\Resources\Themes\THEME_NAME\DesktopBackground. Any other theme files (like sounds, etc) should be copied to appropriate folders under %SystemRoot%\Resources\Themes\THEME_NAME.
  5. Open .theme file up for editing.
  6. Remove ImagesRootPIDL setting under Slideshow section of the file.
@GuyPaddock
GuyPaddock / HOWTO.md
Last active Jun 9, 2019
WIP: Configure RRAS on Server 2016 when Anywhere Access VPN is Enabled
View HOWTO.md

If you enable Anywhere Access VPN in WSE 2016, you will no longer be able to access RRAS admin UI. The message "Legacy mode is disabled" appears. This is because Access Anywhere configures the VPN in WS in a way that cannot be represented in the legacy UI. This makes it nearly impossible to setup other RRAS functionality like NAT or RAS, and there does not appear to be PowerSell cmdlets to address these gaps.

As a workaround, do not use Anywhere Access VPN. Instead, configure VPN manually in the RRAS admin UI. If you need to enable NAT + VPN, you will need to take special care to configure NAT first. For some reason, configuring NAT + VPN in one step leads to the NAT not functioning properly.

@GuyPaddock
GuyPaddock / print-time-and-checksum.sh
Created May 3, 2019
Calculate checksum over kubectl bash without timing out
View print-time-and-checksum.sh
#!/usr/bin/env bash
(while true; do date; sleep 1; done) &
sha1sum * | tee checksums.txt
@GuyPaddock
GuyPaddock / split_zip.sh
Last active Mar 18, 2019
Split a ZIP archive for Drupal Feeds Fetcher Archive + CSV into separate archives < 100 MB each (needed for Pantheon)
View split_zip.sh
#!/usr/bin/env bash
##
# @file
# Asset Zip Splitter
#
# Splits a ZIP archive containing the following file structure into separate
# archives that contain no more than 100 MB each:
# - *.csv (CSV files that reference image files)
# - images/ (a folder of images referenced by the image files)
You can’t perform that action at this time.