Skip to content

Instantly share code, notes, and snippets.

@josdejong
josdejong / npm.js
Last active March 14, 2024 22:28
Helper function to load ESM packages from NPM in your browser dev tools console
/**
* Load an ESM package from npm in your JavaScript environment.
*
* Loads packages from https://www.npmjs.com/ via the CDN https://www.jsdelivr.com/
*
* Usage:
*
* const lodash = await npm('lodash-es')
* const lodash = await npm('lodash-es@4')
* const lodash = await npm('lodash-es@4.17.21')
@tomdaley92
tomdaley92 / README.md
Last active June 28, 2024 18:49
Proxmox - SPICE Client setup for MacOS

Proxmox - SPICE client setup for MacOS

  1. Install a working (and compiled) version of virt-viewer. You may view the homebrew package's upstream source on GitHub.

    brew tap jeffreywildman/homebrew-virt-manager
    brew install virt-viewer
  2. Once that's installed should be able make a call remote-viewer with a pve-spice.vv file downloaded from proxmox web interface

@ArrayIterator
ArrayIterator / example.com.conf
Last active November 3, 2023 01:24
Nginx Configuration Detect User-Agent
server {
listen 80;
listen 443 ssl http2;
server_name example.com;
root /path/to/public/www;
# ADD HEADERS
# Using nginx-http-mod-headers-more
# https://github.com/openresty/headers-more-nginx-module
more_set_headers 'X-Browser-Os: $client_browser_os';
@brokenmass
brokenmass / Chrome enable ExternalProtocolDialogShowAlwaysOpenCheckbox
Last active August 9, 2021 10:36
show "always allow" checkbox in Chrome external protocol permission popup on apple mac osx
# Since Chrome 77 is not possible by default to always allow an application to handle an external protocol (pulsesecure, zoom, etc)
# Since Chrome 79, the 'ExternalProtocolDialogShowAlwaysOpenCheckbox' policy is available to restore the previous behviour and present
# the user with a checkbox to save the preference. To enable it simply run the following command in your terminal
defaults write com.google.Chrome ExternalProtocolDialogShowAlwaysOpenCheckbox -bool true
@darwin
darwin / readme.md
Last active April 9, 2024 22:30
APFS Container cloning/replicating under Catalina (with a bootable system)

Today I wanted to move existing APFS-resident macOS Catalina installation to a new disk. I upgraded my late 2014 Mac Mini with a shiny new 1TB SSD. This took way too many hours of my life I will never get back. Hope this saves some time to you.

Good news:

  1. it is possible to create a DMG image from existing APFS container with macOS Catalina installation including metadata needed for complete restore (the DMG contains OS, OS Data, Preboot, Recovery and VM volumes)
  2. it is possible to restore this DMG image into empty APFS container and get a bootable copy of the original system

This information is relevant for Catalina (I'm currently running macOS 10.15.1).

@ralphschindler
ralphschindler / AuthServiceProvider.php
Last active April 5, 2019 09:04
Laravel 5.8 Policy Guesser For Using "Models" Directory
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
@jakebathman
jakebathman / logslaravel.sh
Created August 19, 2018 00:06
Tail Laravel logs and filter out the stack traces
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
@loilo
loilo / magic-methods.js
Last active June 15, 2024 07:36
PHP Magic Methods in JavaScript
function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args, receiver) => {
// Wrapped class instance
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active June 30, 2024 15:05 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@JacobDB
JacobDB / inline-svg-function.scss
Created January 26, 2017 17:45 — forked from B-iggy/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}