Skip to content

Instantly share code, notes, and snippets.

@alexdelprete
alexdelprete / WF Tempest Node-Red Flow (HA+MQTT).json
Created May 3, 2021 15:19
WF Tempest Node-Red Flow (HA+MQTT)
[
{
"id": "7725e362.54641c",
"type": "tab",
"label": "WeatherFlow Tempest (HA+MQTT) ",
"disabled": false,
"info": ""
},
{
"id": "e4e51e81.61592",
@redlotus
redlotus / docstrings.py
Created October 2, 2017 04:34
Google Style Python Docstrings
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@bilson
bilson / install-spyserver-rpi.sh
Last active April 26, 2024 01:21
Install Spyserver in Raspberry Pi for AirspyHF+, mini and R2. Autodetect 32 and 64 bits version.
#!/bin/bash
CURDIR=$(pwd)
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m'
ORANGE='\033[0;33m'
PURPLE='\033[0;35m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.MutableSnapshot
import androidx.compose.runtime.snapshots.Snapshot
import java.util.WeakHashMap
@PublishedApi
internal class DebugStateObservation(private val id: String) {
private val map = WeakHashMap<Any, MutableList<Exception>>()
@Grubba27
Grubba27 / generic-proxy.ts
Created January 3, 2024 19:56
create your own tRPC-like api with JavaScript proxy and a little bit of ts magic
const setProxySettings = (
{
call,
filter,
}: {
call: ({ path, args }: { path: unknown; args: unknown[] }) => any;
filter: (path: string[]) => unknown;
} = {
call: ({ path, args }) => {
return {
@miyouzi
miyouzi / nginx_with_socat.md
Last active April 26, 2024 01:13
配置 Nginx 通过代理访问反代目标(B站代理解析)

简介

众所周知,有些服务存在着地区限制,我们可以通过在服务所属地区搭建代理服务来解决,其中在其服务范围内部署 Nginx 反代服务是个有效且流行的办法。

但如果区域很多,每个区域都布置一台服务器那成本会有些高昂且利用率很低,通常我们只是需要该地区的 IP 而已,如果手头上正好有这些地区的代理池的话,那我们就可以只用一台服务器部署Nginx反向代理结合服务所在地区的代理实现相同的效果。

本文着重介绍的就是如何让 Nginx 通过代理访问上游服务。(即 proxy_pass 的目标)

详细图文说明可以参见《Nginx 如何与 Socat 配合使用》

PS:本配置兼容 《哔哩漫游》《解除b站区域限制》

@VictorTaelin
VictorTaelin / hvm_standalone.cu
Last active April 26, 2024 01:13
HVM-CUDA - First Prototype - 6.7 billion RPS
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
@pauloevpr
pauloevpr / hx-clone.js
Created January 7, 2024 19:47
Simple HTMX extension to allow cloning <template> elements in the DOM to avoid a round trip to the server.
htmx.config.useTemplateFragments = true
htmx.defineExtension('clone', {
onEvent: function (name, evt) {
if (name === 'htmx:beforeRequest') {
if (evt.detail.elt) {
const get = evt.detail.elt.getAttribute('hx-get')
if (get && get.startsWith('clone:')) {
const selector = get.substring(6)
//console.log('htmx-clone: Intercepting xhr request to inject template with selector:', selector)
const template = document.querySelector(selector)
@fatbobman
fatbobman / AnimatableTrigger.swift
Created September 3, 2022 01:12
检查可动画数据的状态
//
// AnimatableTrigger.swift
// ScrollViewDemo
//
// Created by Yang Xu on 2022/9/2.
//
import Foundation
import SwiftUI