Skip to content

Instantly share code, notes, and snippets.

View blinkinglight's full-sized avatar
🏠
Working from home

M blinkinglight

🏠
Working from home
View GitHub Profile
@blinkinglight
blinkinglight / main.go
Last active March 16, 2025 13:27
something with events
package main
import (
"context"
"fmt"
"log"
"strings"
"time"
"github.com/ituoga/the-system/pkg/tools"
#include <TimerOne.h>
const int encoderPinA = 2; // Connected to interrupt 0 (pin 2)
const int encoderPinB = 3; // Connected to interrupt 1 (pin 3)
const int stepPin = 9;
const int dirPin = 8;
// Variables to track encoder state
volatile int32_t encoderPositionX = 0;
volatile int32_t encoderPositionY = 0;
volatile int32_t encoderPositionZ = 0;
volatile bool lastEncodedState = false;
<html>
<head>
<meta name="theme-color" content="#0d085c"/>
<link rel="manifest" href="/manifest.json"/>
</head>
from flask import Flask, Response
import time
app = Flask(__name__)
def root_dir(): # pragma: no cover
return os.path.abspath(os.path.dirname(__file__))
<script>
class MyArray extends HTMLElement {
constructor() {
super();
this.store = {};
const template = document.createElement("template");
const id = Math.random().toString(36).substr(2, 9);
template.innerHTML = `<div id="input-${id}">hi</div>`;
this.shadow = this.attachShadow({ mode: "open" });
this.shadow.appendChild(template.content.cloneNode(true));
class MyCustomElement extends HTMLElement {
constructor() {
super();
const template = document.createElement('template');
template.id = 'pool-calculator-template';
template.innerHTML = `
<input type="text" id="input"/>
`;
// this.appendChild(template);
package main
import (
"context"
"fmt"
"log"
"net/http"
)
type MyContext struct {
@blinkinglight
blinkinglight / main.go
Last active August 26, 2024 17:51
htmx.org sse
package main
import (
"fmt"
"net/http"
"time"
"github.com/r3labs/sse/v2"
)
@blinkinglight
blinkinglight / test.php
Last active August 11, 2024 15:29
laravel test
<?php
use App\Models\User;
test('Action', function () {
app()->singleton(ClassInterface::class, T1Impl::class);
$out1 = app(ClassInterface::class)();
$this->assertEquals("T1?", $out1);
@blinkinglight
blinkinglight / cmd-to-websocket.go
Created July 26, 2024 07:45 — forked from rochacon/cmd-to-websocket.go
Stream a command stderr and stdout throught websockets
package main
import (
"bufio"
"fmt"
"github.com/gorilla/websocket"
"io"
"log"
"net/http"
"os/exec"