Skip to content

Instantly share code, notes, and snippets.

View briantully's full-sized avatar

Brian Tully briantully

View GitHub Profile
#!/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 / GPG-Tower
Created February 17, 2023 16:10 — forked from LeonardoCardoso/GPG-Tower
How to setup Tower to use the GPG Suite
# GPG on Tower
@briantully
briantully / wordle.md
Created February 5, 2022 06:25 — forked from huytd/wordle.md
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@briantully
briantully / migrate.sh
Created January 6, 2022 21:48 — forked from adamzimmermann/migrate.sh
Migration Script with Limit/Looping
#!/bin/bash
migrate_loop()
{
# Better readability with separation.
echo "========================";
# Get the output of the drush status.
drush_output=$(drush ms "$1" --format string);
# Split output string into an array.
@briantully
briantully / nginx.conf
Created April 6, 2021 19:12 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@briantully
briantully / DiskUtil.sh
Created February 9, 2021 16:00 — forked from joevt/DiskUtil.sh
macOS disk labels, mounting partitions
#!/bin/bash
# by joevt Jan 31, 2021
directbless="/Volumes/Work/Programming/XcodeProjects/bless/bless-204.40.27 joevt/DerivedData/bless/Build/Products/Debug/bless"
alias directbless='"$directbless"'
if [[ ! -f "$directbless" ]]; then
echo "# Download and build bless from https://github.com/joevt/bless , then update the path of directbless defined in DiskUtil.sh"
directbless=bless
alias directbless=bless
fi
@briantully
briantully / gfxutil.sh
Created January 28, 2021 04:43 — forked from joevt/gfxutil.sh
macOS nvram boot variables, device properties, EFI device paths
# joevt Dec 30, 2020
# https://forums.macrumors.com/threads/documentation-on-all-parameters-for-nvram.2239034/post-28518123
gfxutilcmd=~/Downloads/gfxutil
alias gfxutil="'$gfxutilcmd'"
nvramp () {
local thename="$1"
local thedata="" # must declare local separately for $? to get the error
/**
* 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:
@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
@briantully
briantully / z.md
Last active March 12, 2020 17:51 — forked from mischah/z.md
Installing und initializing z (https://github.com/rupa/z) with help of Homebrew.

#The power of z

Do you spend lots of time doing things like this?

cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwant

With z, you could just do this: