Skip to content

Instantly share code, notes, and snippets.

View ohthehugemanatee's full-sized avatar
💭
I may be slow to respond.

Campbell Vertesi ohthehugemanatee

💭
I may be slow to respond.
View GitHub Profile
@ohthehugemanatee
ohthehugemanatee / enable-cli-xdebug.sh
Created September 20, 2016 08:20
once xdebug is working globally, we can enable it for the CLI. Note the alias 'xdebug-on'. Ideally there should be an xdebug-off, too...
#!/bin/bash
# Enable CLI xdebug when the IDEkey is available in environment.
# Run this script on the GUEST machine with `docker-compose exec drupal /var/www/drupal/public_html/enable-cli-xdebug.sh`
# use it with 'export XDEBUG_CONFIG="idekey=foobar"'
# Note: PHPStorm also requires 'export PHP_IDE_CONFIG="serverName=popo.docker.amazee.io"'
sudo rm /etc/php/7.0/cli/conf.d/20-xdebug.ini
sudo echo 'zend_extension=xdebug.so' > /etc/php/7.0/cli/conf.d/20-xdebug.ini
sudo echo 'xdebug.remote_enable = on' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini
if grep --quiet dockerhost /etc/php/fpm-pool/drupal-xdebug.conf; then
@ohthehugemanatee
ohthehugemanatee / update-xdebug-hostname.sh
Created September 20, 2016 08:22
Updates the xdebug hostname to "dockerhost", which is set to the host system's IP. This one actually requires "docker-compose restart", the service restart isn't enough.
#!/bin/bash
# To be run from inside the docker container. This script updates PHP settings to use the 'dockerhost' hostname
# rather than auto-discovery.
# The dockerhost hostname only works when your host machine has it's IP address in a variable called DOCKERHOST
# Fix host settings for web-based xdebug
sudo sed -i '/remote_connect_back/d' /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_flag[xdebug.remote_connect_back] = off' >> /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_admin_value[xdebug.remote_host] = "dockerhost"' >> /etc/php/fpm-pool/drupal-xdebug.conf
Array
(
[json] => Array
(
[tags] => Array
(
[0] => b82
[1] => 0e7
[2] => dbc
[3] => 633
@ohthehugemanatee
ohthehugemanatee / keycdn.php
Last active May 14, 2017 13:47
how I invalidated keycdn
<?php
// Invalidate and update the item state.
$hashes = KeycdnCacheTagHeaderGenerator::cacheTagsToHashes($tags);
// Break the list of tags into multiple requests.
$hash_sets = array_chunk($hashes, 1000);
foreach ($hash_sets as $hash_set) {
$invalidation_state = $this->invalidateItems('tags', $hash_set);
}
[ 0.000000] Linux version 4.12.5-041205-generic (kernel@tangerine) (gcc version 6.3.0 20170618 (Ubuntu 6.3.0-19ubuntu1) ) #201708061334 SMP Sun Aug 6 17:35:26 UTC 2017
[ 0.000000] Command line: BOOT_IMAGE=/@/boot/vmlinuz-4.12.5-041205-generic root=UUID=c0d21ade-5570-41a3-b0cf-a5ce219e7a8e ro rootflags=subvol=@ quiet splash video.use_native_backlight=1 vt.handoff=7 drm.debug=0xe
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
@ohthehugemanatee
ohthehugemanatee / RestaurantEntity.php.diff
Created September 18, 2017 11:10
Add revisions to an existing entity. In a project for RAS I had to add revisions to an existing entity. There are some small modifications necessary to the entity class itself, and two update hooks to apply the schema changes (core's normal process won't allow you to modify the schema of an entity type with existing data). Note that entity_ui=TR…
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\RevisionableContentEntityBase;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
@@ -19,6 +20,7 @@
* @ContentEntityType(
* id = "restaurant",
* label = @Translation("Restaurant"),
+ * show_revision_ui = TRUE,
@ohthehugemanatee
ohthehugemanatee / winvm
Created March 6, 2018 11:01
Bash script to start/stop an Azure remote workstation, and connect to it via RDP
#!/bin/bash
# Simple script to start/stop my Azure remote workstation.
# Requires:
# - Azure CLI configured
# - Remmina RDP client
# - Zenity
#
# Change these values to match your VM.
@ohthehugemanatee
ohthehugemanatee / gist:87291f1e77a9b5f920fcb5c74a7805cf
Created June 18, 2019 14:02
track outbound links in google analytics
<script>
//Track Outbound Link Clicks
(function trackOutbounds() {
var hitCallbackHandler = function(url,win) {
if (win) {
window.open(url, win);
} else {
window.location.href = url;
2020-02-18 12:20:05 - [sway/main.c:152] Linux Wotan 5.4.18-1-MANJARO #1 SMP PREEMPT Thu Feb 6 11:41:30 UTC 2020 x86_64 GNU/Linux
2020-02-18 12:20:05 - [sway/main.c:168] Contents of /etc/lsb-release:
2020-02-18 12:20:05 - [sway/main.c:152] DISTRIB_ID=ManjaroLinux
2020-02-18 12:20:05 - [sway/main.c:152] DISTRIB_RELEASE=19.0.0
2020-02-18 12:20:05 - [sway/main.c:152] DISTRIB_CODENAME=Kyria
2020-02-18 12:20:05 - [sway/main.c:152] DISTRIB_DESCRIPTION="Manjaro Linux"
2020-02-18 12:20:05 - [sway/main.c:168] Contents of /etc/os-release:
2020-02-18 12:20:05 - [sway/main.c:152] NAME="Manjaro Linux"
2020-02-18 12:20:05 - [sway/main.c:152] ID=manjaro
2020-02-18 12:20:05 - [sway/main.c:152] ID_LIKE=arch
@ohthehugemanatee
ohthehugemanatee / sway.log
Created July 9, 2020 09:24
sway debug log for output issue
00:00:00.225 [sway/input/seat.c:930] Cannot load xcursor theme for output 'eDP-1' with scale 2.000000
00:00:00.279 [sway/input/seat.c:930] Cannot load xcursor theme for output 'eDP-1' with scale 2.000000
00:00:00.286 [sway/input/seat.c:930] Cannot load xcursor theme for output 'DP-5' with scale 1.000000
00:00:00.334 [sway/input/seat.c:930] Cannot load xcursor theme for output 'eDP-1' with scale 2.000000
00:00:00.334 [sway/input/seat.c:930] Cannot load xcursor theme for output 'DP-5' with scale 1.000000
00:00:00.334 [sway/input/seat.c:930] Cannot load xcursor theme for output 'DP-9' with scale 1.000000
/bin/sh: ff-theme-util: command not found
Got sleep lock: 11
Unknown option -b
Traceback (most recent call last):