Skip to content

Instantly share code, notes, and snippets.

View djvdorp's full-sized avatar

Daniel van Dorp djvdorp

View GitHub Profile
@djvdorp
djvdorp / restart-php-fpm.sh
Last active July 15, 2024 15:52 — forked from zeuxisoo/restart-php-fpm.sh
Auto Restart PHP-FPM when LoadAvg15 under 1
#/bin/bash
# the load average for the last 1, 5, and 15 minutes. we get the third one:
LOAD=$(awk '{print $3}' /proc/loadavg)
if [ $(echo "$LOAD < 1" | bc) = 1 ]; then
/usr/bin/systemctl restart php-fpm
else
echo "All seems well, moving on"
@djvdorp
djvdorp / MacBookNetworkAliveOnSleep.md
Created January 2, 2024 15:18 — forked from jyore/MacBookNetworkAliveOnSleep.md
Keep Your MacBook Network Connections Alive As It Sleeps!

MacBookNetworkAliveOnSleep

As someone that regularly has multiple SSH/VPN sessions open, it can be a huge inconvience to lose all the connections when I lock my screen to get up to go to a meeting, lunch, etc. This is especially true for those connections that require two factor authentication. So, how can I tell my MacBook to keep those connections alive, even though my screen is locked?

Well, turns out that it is pretty simple. All that is needed is to run the following command.

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Title From All Pages
* Credit: Yoast Team
* Last Tested: Aug 11 2017 using Yoast SEO 5.2 on WordPress 4.8.1
*/
add_filter( 'wpseo_title', '__return_false' );
@djvdorp
djvdorp / i3-gaps_installation_guide.md
Created April 10, 2019 11:48 — forked from boreycutts/i3-gaps_installation_guide.md
A simple installation guide for i3-gaps

Installing i3-gaps

Dependencies

i3-gaps has some packages that are required for it to work so install these things:

sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf xutils-dev libtool automake

You also need to install libxcb-xrm-dev, but I got Unable to locate package libxcb-xrm-dev when trying to install from the apt repositories on Ubuntu 16.04. If this happens to you, just install it from source using these commands:

mkdir tmp
@djvdorp
djvdorp / i3-gaps.sh
Created April 10, 2019 11:44 — forked from dabroder/i3-gaps.sh
Install i3-gaps on ubuntu 18.04
#!/bin/bash
sudo apt install -y libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf libxcb-xrm0 libxcb-xrm-dev automake
cd /tmp
# clone the repository
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
# compile & install
@djvdorp
djvdorp / dockerize-env
Created February 11, 2019 15:31 — forked from hudon/dockerize-env
Workaround so you can use `docker run --env-file .env` and read variables with newline escape sequences in them
#!/bin/bash
# Docker can't pass newlines to containers if there are \n in variables in
# --env-file files. This tool creates a $1.exported file with newlines that
# can be sourced before running your container and a $1.vars for you to pass
# to --env-files so docker passes those variables to the container.
# Usage:
# dockerize-env .env
# This creates: .env.vars and .env.exported
@djvdorp
djvdorp / mac.md
Created November 9, 2018 20:44 — forked from lornajane/mac.md
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@djvdorp
djvdorp / sysctl.conf
Created October 29, 2018 16:08 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@djvdorp
djvdorp / docker_kill.sh
Created May 28, 2018 12:33 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@djvdorp
djvdorp / disable_tracker.sh
Created April 26, 2018 06:25 — forked from DanyHenriquez/disable_tracker.sh
Disable tracker Ubuntu 16.04
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-extract.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-apps.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-fs.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-user-guides.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-store.desktop
gsettings set org.freedesktop.Tracker.Miner.Files crawling-interval -2
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false
tracker reset --hard