Skip to content

Instantly share code, notes, and snippets.

@joshuafredrickson
joshuafredrickson / filters.php
Last active May 5, 2024 08:24
Preload font files found in Roots Sage 10 (bud.js) manifest.json
<?php
use Illuminate\Support\Str;
/**
* Add `rel="preload"` to font files found in the manifest
*/
add_filter('wp_head', function (): void {
echo collect(
json_decode(asset('manifest.json')->contents())
@MikeiLL
MikeiLL / .stylelintrc
Created May 20, 2023 19:22
Bootstrap 5 Ignores
{
"plugins": ["stylelint-scss"],
"customSyntax": "postcss-scss",
"extends": [
"@roots/bud-sass/stylelint-config",
"@roots/sage/stylelint-config"
],
"rules": {
"no-descending-specificity": null,
"selector-class-pattern": null,
@hakerdefo
hakerdefo / sources.list
Last active November 6, 2024 16:03
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
function Child({ onClick }) {
return <button onClick={onClick} type="button">Child Button</button>;
}
export default function Parent() {
const onClick = () => {
console.log('I\'m in the parent, but the child was clicked');
};
return (
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Foo</title>
</head>
<body>
<div id="root" data-foo="{&quot;foo&quot;: &quot;bar&quot;}"></div>
</body>
</html>
function OrderForm() {
const { cart, reset } = useCartContext();
const onSubmit = async () => {
try {
await api('foo.com', cart);
reset();
} catch (error) {
console.error(error);
}
import {
createContext,
useContext,
useEffect,
useMemo,
useState,
} from 'react';
export const CartContext = createContext(null);
export function useCartContext() {
import {
createContext,
useContext,
useEffect,
useMemo,
useState,
} from 'react';
export const CartContext = createContext(null);
export function useCartContext() {
@nitred
nitred / optimal_mtu.md
Last active November 13, 2024 12:36
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@eddieparker
eddieparker / playbook.yml
Last active December 4, 2021 11:21
KeeAgent ansible playbook for ubuntu on WSL
# Instructions forged into playbook from https://gist.github.com/strarsis/e533f4bca5ae158481bbe53185848d49
# To use:
# - Install ansible (apt-get update -y && apt-get install -y ansible)
# - Run "ansible-playbook playbook.yml" wherever you downloaded this gist to.
# - Don't forget to "Enable agent for Windows OpenSSH (experimental)" in keepass to allow this to work.
---
- name: Setup for keepass
hosts: localhost
remote_user: root