Skip to content

Instantly share code, notes, and snippets.

View briantully's full-sized avatar

Brian Tully briantully

View GitHub Profile
@huytd
huytd / wordle.md
Last active May 2, 2024 12:13
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

#!/bin/bash
#Switch between PHP 7.4 and 8.0 and Drush Version 8 and 11
# To use this script download this file and name it switch-php.sh
# and give it the correct permissions
# You can then run ./switch-php
# with the argument 7.4 or just ./switch-php
# For example ./switch-php 7.4
## First need to download PHP Versions
@briantully
briantully / aws-ip-ranges-by-region.sh
Last active October 20, 2021 20:37
AWS EC2 Instances IP Ranges by Region
#!/usr/bin/env bash
# Call AWS endpoint for IP Ranges and filter by service (EC2) and region
# @author Brian Tully <brian.tully@acquia.com>
usage ()
{
echo "-----------------------------------------------------------------------"
echo "usage: $0 'REGION'"
echo "where 'REGION' is the AWS region name, e.g. 'us-east-1'"
@joevt
joevt / DiskUtil.sh
Last active May 11, 2023 06:34
macOS disk labels, mounting partitions
#!/bin/bash
# by joevt May 10, 2023
directblesscmd="/Volumes/Work/Programming/XcodeProjects/bless/bless-204.40.27 joevt/DerivedData/bless/Build/Products/Debug/bless"
usedirectbless=0
if [[ -d /System/Library/PrivateFrameworks/APFS.framework/Versions/A ]]; then
if [[ ! -f "$directblesscmd" ]]; then
echo "# Download and build bless from https://github.com/joevt/bless , then update the path of directbless defined in DiskUtil.sh"
else
usedirectbless=1
@joevt
joevt / gfxutil.sh
Last active October 9, 2023 16:15
macOS nvram boot variables, device properties, EFI device paths
#!/bin/bash
# joevt Jun 13, 2023
# https://forums.macrumors.com/threads/documentation-on-all-parameters-for-nvram.2239034/post-28518123
gfxutilrepository="/Volumes/Work/Programming/EFIProjects/gfxutil/joevt-gfxutil"
for gfxutilcmd in \
~/Downloads/gfxutil/gfxutil \
~/Downloads/gfxutil \
"$gfxutilrepository/build/Release/gfxutil" \
"$gfxutilrepository/build/Debug/gfxutil" \
@briantully
briantully / .env
Created June 3, 2020 15:11 — forked from tylers-username/.env
Install Blackfire on Lando & Automatically Configure
####
## Blackfire config - `lando rebuild` required
####
BLACKFIRE_CLIENT_ID=b5ee8ca3-****-****-****-5d227546a4c0
BLACKFIRE_CLIENT_TOKEN=3a2b88cbfb*******************************22763
BLACKFIRE_SERVER_ID=4b8ac335-****-****-****-b34439207732
BLACKFIRE_SERVER_TOKEN=98f7fdf4b12b7**************************12b837cf080d
/**
* Implements hook_ENTITY_TYPE_presave().
*/
function [modulename]_media_media_presave(EntityInterface $entity) {
if ($entity->bundle() == 'document') {
foreach ($entity->field_media_file as $file_reference) {
$file = File::load($file_reference->target_id);
switch ($entity->status->value) {
// Unpublish, set to private.
case 0:
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@tylers-username
tylers-username / .env
Last active August 3, 2021 22:05
Install Blackfire on Lando & Automatically Configure
####
## Blackfire config - `lando rebuild` required
####
BLACKFIRE_CLIENT_ID=b5ee8ca3-****-****-****-5d227546a4c0
BLACKFIRE_CLIENT_TOKEN=3a2b88cbfb*******************************22763
BLACKFIRE_SERVER_ID=4b8ac335-****-****-****-b34439207732
BLACKFIRE_SERVER_TOKEN=98f7fdf4b12b7**************************12b837cf080d
@swichers
swichers / jsonapi.vcl
Created August 1, 2018 22:22
Varnish VCL for checking authorization against a different page and then forcing a cached response.
vcl 4.0;
# !!Important!! Do not use this if your authenticated response can vary
# between users or roles.
# Note: This is only useful if the following things are true:
# * Access to the jsonapi endpoints is restricted to authorized users only.
# * jsonapi request results will be the same for all authorized users. No
# customized or filtered results based on role or other access checks.