Skip to content

Instantly share code, notes, and snippets.

@plmcgrn
plmcgrn / sonos-udm-mutiple-networks.md
Last active April 25, 2024 12:57
Unifi UDM and Sonos home theater with multiple VLAN's

Overview

This goal of this setup is to put the Sonos speakers on an untrusted network to keep all but the required traffic away from the trusted network where devices like personal computers, phones, etc. live. This write-up assumes you already have two networks setup and working.

Important Note on Unifi OS 3.x

UI broke cross-VLAN multicast DNS in this version. See below for steps to install the multicast-relay script to re-enable this. Without it, your Sonos controller app will not be able to discover your speakers on the other VLAN.

System

I have a Sonos Playbar, Sub, and 2 Play:3's as rear surrounds as one home theater setup connected to a UDM (non-Pro, but this should work on Pro too). Some of this setup may be easier for people with non-paired speakers, as Sonos does some shenanigans with which speaker is actively sending traffic to your wifi.

@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 25, 2024 12:54
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@Coding-Enthusiast
Coding-Enthusiast / BitwiseOperations.md
Last active April 25, 2024 12:53
Bitwise operations cheat sheet

AND (&)

100  
101  
---  
100  

OR (|)

100  
101  
---  

101

@ismailyenigul
ismailyenigul / nginx-traefik-v2-docker-compose.yml
Last active April 25, 2024 12:52
nginx and traefik v2 deployment with docker-compose
1. create a network with docker network create NETWORKNAME
2. Create letsencrypt directory for acme.json ie /docker/letsencrypt directory or somewhere else mkdir -p /docker/letsencrypt
3. I configured http -> https redirect
# cat docker-compose.yml
version: '3.3'
services:
traefik2:
image: traefik
@IT-DO
IT-DO / GameSnake.java
Created March 31, 2020 18:42
Простая змейка на Java
package com.gamesnake;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
@mxalbert1996
mxalbert1996 / Scrollbar.kt
Last active April 25, 2024 12:48
Modifiers to draw scrollbars in Jetpack Compose
/*
* MIT License
*
* Copyright (c) 2022 Albert Chang
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@dyaa
dyaa / ajaxerror.js
Created September 22, 2013 13:03
JQUERY AJAX ERROR HANDLING FUNCTION
$(function() {
$.ajaxSetup({
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
@wojtekmaj
wojtekmaj / jest-to-vitest.sh
Last active April 25, 2024 12:46
Automatically migrate Jest project to Vitest
#!/bin/bash
# Ensure we're working on the latest version of the main branch
git switch main
git fetch
git pull
# Create a new branch
git switch -c vitest
lambda function
----
exports.handler = async (event) => {
console.log(event)
const customerId = event.pathParameters.customerId;
const customer = {'customerId': customerId, 'customerName': "Customer " + customerId };
const response = {
statusCode: 200,
// Uncomment below to enable CORS requests
headers: {
@FUSAKLA
FUSAKLA / debugging-slow-grafana-dashboard.md
Last active April 25, 2024 12:45
Speeding up Grafana dashboard

Intro

So your dashboard is slow? We are doing our best but maybe it's time to think if the issue isn't on your side.

Some of our dashboards looks like https://www.theworldsworstwebsiteever.com/. Are you sure you really need to see all the time all the data? Or do you really need to see data for last week or month all the time? How often do you use filtering by some of those variables in your dashboard?

Let's not end up as your mother saying:

But.. but.. I might need this in future so let's leave this icon on the Desktop.