Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Tully briantully

View GitHub Profile
@briantully
briantully / nginx.conf
Created Apr 6, 2021 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
View nginx.conf
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 Feb 9, 2021 — forked from joevt/DiskUtil.sh
macOS disk labels, mounting partitions
View DiskUtil.sh
#!/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 Jan 28, 2021 — forked from joevt/gfxutil.sh
macOS nvram boot variables, device properties, EFI device paths
View gfxutil.sh
# 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
View media_publish_unpublish
/**
* 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 Jun 3, 2020 — forked from tylerssn/.env
Install Blackfire on Lando & Automatically Configure
View .env
####
## 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 Mar 12, 2020 — forked from mischah/z.md
Installing und initializing z (https://github.com/rupa/z) with help of Homebrew.
View z.md

#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:

@briantully
briantully / boost-low-pri-macOS.sh
Created Oct 25, 2019 — forked from mayankk2308/boost-low-pri-macOS.sh
Boost Low-Priority Tasks on macOS
View boost-low-pri-macOS.sh
# Useful for improving Time Machine backup prep. times, Mac App Store install speeds, etc.
sudo sysctl debug.lowpri_throttle_enabled=0
# To restore defaults
sudo sysctl debug.lowpri_throttle_enabled=1
@briantully
briantully / locustfile.py
Created Sep 12, 2019 — forked from yamionp/locustfile.py
Websocket Locust Sample. locustfile and Echo/Chat Server
View locustfile.py
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import json
import uuid
import time
import gevent
@briantully
briantully / drupal-quick-dump.sh
Created May 1, 2019 — forked from webbj74/drupal-quick-dump.sh
Script to dump Drupal database structure, but exclude data from massive/unneeded tables.
View drupal-quick-dump.sh
#!/bin/bash
# usage: drupal-quick-dump user host database
USER="$1"
HOST="$2"
DB="$3"
DATE=`date +%Y%m%d`
# Get User Password
echo "Please provide the password for ${USER} on db ${DB} hosted at ${HOST}:"
View drupal_phpstan_bootstrap.php
<?php
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\DrupalKernel;
$autoload = require __DIR__ . '/vendor/autoload.php';
$cwd = getcwd();
chdir('docroot');
$drupalKernel = DrupalKernel::createFromRequest(