Skip to content

Instantly share code, notes, and snippets.

@bdelwood
bdelwood / ufw_plex.md
Created November 5, 2017 04:06 — forked from nmaggioni/ufw_plex.md
Plex Media Server UFW rule

/etc/ufw/applications.d/plexmediaserver

[plexmediaserver]
title=Plex Media Server (Standard)
description=The Plex Media Server
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp

[plexmediaserver-dlna]
title=Plex Media Server (DLNA)
description=The Plex Media Server (additional DLNA capability only)
@OrionReed
OrionReed / DOM3D.js
Last active March 29, 2024 01:32
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@regakakobigman
regakakobigman / get_node_property.gd
Last active March 29, 2024 01:31
Gets the property of a node using a NodePath
# This is an awful solution, but NodePath is missing an important method, so there's no great alternative that I've found.
# Try me with get_node_property(self, "Control/Spatial/CollisionShape2D:shape:extents:x")
func get_node_property(from: Node, path: NodePath):
assert ":" in path as String # Causes a hard crash
path = path as NodePath
var node_path = get_as_node_path(path)
var property_path = (path.get_concatenated_subnames() as NodePath).get_as_property_path()
return from.get_node(node_path).get_indexed(property_path)
@virolea
virolea / index.js
Created October 23, 2019 09:40
Configure axios to automatically set the Rails CSRF token
import axios from 'axios'
const tokenEl = document.getElementsByName('csrf-token')[0]
if (tokenEl) {
const token = tokenEl.getAttribute('content')
axios.defaults.headers.common['X-CSRF-Token'] = token
}
axios.defaults.headers.common['Accept'] = 'application/json'
axios.defaults.headers.post['Content-Type'] = 'application/json'
@randompherret
randompherret / quantity_unit.php
Last active March 29, 2024 01:29
Script to import conversion factors into grocy
<?php
$apiaccess =[
"url" => "https://grocy.yourdomain.tld/api",
"key" => "1234password"
];
$quantity_units = [
"Cup" => [
"name" => "Cup",
"description" => "",
"name_plural" => "Cups"
@terrychan999
terrychan999 / wordpress_lnmp.md
Last active March 29, 2024 01:28
Wordpress LNMP/LEMP 環境建置

Wordpress LNMP/LEMP 環境建置

Create by @terrychan999 on 2021-Apr-30, feel free to share :)

  1. Linux ENV: Ubuntu 20.04 Server

    此教學僅在Ubuntu 20.04測試過

  2. 更新apt套件庫
    sudo apt update && sudo apt upgrade

@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active March 29, 2024 01:25
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Alt Text

First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.

@chrisdiana
chrisdiana / opz-cheatsheet.md
Last active March 29, 2024 01:25
OP-Z Cheatsheet

OP-Z Cheatsheet

General

  • Play: Press Play
  • Stop: Press Stop
  • Sequence: Hold Trig + key
  • Sequence v2: Hold Rec + keys
  • Live Record: Hold Rec + Play + key/Play
  • Stop Recording: Press Rec
@cassidoo
cassidoo / base-css.md
Created May 4, 2022 06:37
Base CSS for a plain HTML document

If you don't want to deal with styling a mostly text-based HTML document, plop these lines in and it'll look good:

html {
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  font-size: 1.3em;
  max-width: 40rem;
  padding: 2rem;
  margin: auto;
 line-height: 1.5rem;