Skip to content

Instantly share code, notes, and snippets.

@radicalrad
radicalrad / gist:4824e10445a682ee61aa038d7657fc72
Created June 25, 2018 10:02
TCL P64 DLNA Profile identification
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
<friendlyName>MS6586_EU(192.168.0.186)</friendlyName>
<manufacturer>TCL</manufacturer>
<manufacturerURL>http://www.tcl.com</manufacturerURL>
@zph
zph / jira-cli
Last active July 2, 2025 10:34
jira-cli
#!/usr/bin/env bash
set -eou pipefail
jira issue list \
-a$(jira me) \
--plain \
--columns id,summary,status |
fzf \
--layout=reverse \
@SomajitDey
SomajitDey / freemium_port_forwarding_services.md
Last active July 2, 2025 10:30
A list of free or freemium services for exposing localhost to internet with a public ip
@alexreinking
alexreinking / CMakeLists.txt
Created February 15, 2023 16:48
Basic executable packaging/export example in CMake
cmake_minimum_required(VERSION 3.25)
project(example VERSION 0.1.0)
add_executable(example main.cpp)
add_executable(example::example ALIAS example)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(EXAMPLE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/cmake/Example"
@kincaidoneil
kincaidoneil / prisma.ts
Last active July 2, 2025 10:27
Connect to Supabase with Prisma on the Edge (e.g. Vercel Edge functions). Test locally by running the Supabase connection pooler
import { neonConfig, Pool } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import { WebSocket } from 'ws'
// Example Supabase pooled connection string (must use Supavisor)
const connectionString =
'postgres://[username].[id]:[password]@aws-0-us-east-1.pooler.supabase.com:5432/[db]'
const url = new URL(connectionString)
@geekman
geekman / ethtool-noautoneg@.service
Created July 4, 2016 16:29
systemd unit to disable auto-negotiation for Ethernet ports
[Unit]
Description=Disable auto-negotiation for %i
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
ExecStart=/usr/bin/ethtool -s %i duplex full speed 100 autoneg off
Type=oneshot
[Install]
@wojteklu
wojteklu / clean_code.md
Last active July 2, 2025 10:22
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@mtt87
mtt87 / _middleware.ts
Created December 21, 2021 14:39
Add password protection to any Vercel website, save $150/month.
import { addYears } from 'date-fns'
import { NextRequest, NextResponse } from 'next/server'
function middleware(req: NextRequest) {
if (req.nextUrl.pathname.startsWith('/api')) {
return NextResponse.next()
}
if (process.env.VERCEL_ENV !== 'preview') {
return NextResponse.next()
@kelvinauta
kelvinauta / remove_comments.lua
Created July 2, 2025 04:07
This function removes all comments from your code using treesitter in nvim.
local RemoveComments = function()
local ts = vim.treesitter
local bufnr = vim.api.nvim_get_current_buf()
local ft = vim.bo[bufnr].filetype
local lang = ts.language.get_lang(ft) or ft
local ok, parser = pcall(ts.get_parser, bufnr, lang)
if not ok then return vim.notify("No parser for " .. ft, vim.log.levels.WARN) end
local tree = parser:parse()[1]