Skip to content

Instantly share code, notes, and snippets.

View mikebarnhardt's full-sized avatar

Mike Barnhardt mikebarnhardt

  • 次元の狭間
View GitHub Profile
mikebarnhardt / cli.txt
Created April 28, 2023 12:38
Fix Magento2 admin login page redirecting
bin/magento config:set system/security/max_session_size_admin 2560000
mikebarnhardt / gist:03aac732959881b5900f77ae59f0cdc4
Created March 23, 2023 14:23
Fix client_body_temp permissions using Nginx on MacOS
cd /usr/local/var/run/nginx
sudo chown -R user_name:admin client_body_temp/
mikebarnhardt / html.txt
Created February 28, 2023 14:19
Create a Notepad from URL as browser start page
data:text/html, <html contenteditable style="background-color: hsl(232deg, 16%, 8%); color: hsl(232deg, 16%, 80%); font-family: ui-monospace, Menlo,Monaco, 'Cascadia Mono','Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro','Fira Mono', 'Droid Sans Mono', 'Courier New', monospace; font-size: 16px; max-width: 80ch; margin: 2rem auto;">
mikebarnhardt / resinstall-xcode-cli.txt
Last active June 8, 2021 13:31
Reinstall Xcode Command Line Tools.
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
mikebarnhardt / git-track-case.txt
Last active January 31, 2022 14:31
Force Git to track case changes in filenames.
git config --unset-all core.ignorecase && git config --system core.ignorecase false
mikebarnhardt /
Created February 7, 2018 15:51
Generate and Add SSH Key to a Server


Generate a key if needed:

ssh-keygen -t rsa

It should now be located in: ~/.ssh/ as id_rsa and

mikebarnhardt / render.js
Created January 16, 2018 14:10
PDF.js with text selection
// Taken from
var page_num = 1;
var scale = 1.5;
var viewport = page.getViewport(scale);
var canvas = $('#the-canvas')[0];
var context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
mikebarnhardt / treeify.js
Created January 16, 2018 14:08
Hierarchy tree from flat list
// Taken from
function treeify(list, idAttr, parentAttr, childrenAttr) {
if (!idAttr) idAttr = 'id';
if (!parentAttr) parentAttr = 'parent';
if (!childrenAttr) childrenAttr = 'children';
var treeList = [];
var lookup = {};
list.forEach(function(obj) {
lookup[obj[idAttr]] = obj;
mikebarnhardt / shuffle.js
Created January 16, 2018 14:06
Fisher-Yates Shuffle
// Taken from
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
mikebarnhardt /
Created January 2, 2018 14:39
Give www folder to group permissions.

Add your Node user. If Apache or something else this could be www-data.

sudo adduser nodejs

Add users to that group to allow access to the www directory.

sudo usermod -aG nodejs <username>