Skip to content

Instantly share code, notes, and snippets.

View blinkinglight's full-sized avatar

M blinkinglight

View GitHub Profile
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"

file.txt contents

one
some text two
three

start app

$ APP_LISTEN=cli.cmd.two ./wrapper -stdin -- grep "some text"
#!/usr/bin/env python3
events = [
{
"id" : 1,
"name" : "user.created",
"payload" : "name: labas, email:krabas",
"created" : "2024-01-01 12:13:14"
},
package main
import (
"log"
"net/http"
"time"
"github.com/go-chi/chi/v5"
)
{{ define "htmlbody" }}
<h1>Page 1</h1>
{{ range .Items }}
{{ block "item-row" . }}
<div>
your page content {{ . }}
</div>
{{ end }}
{{ end }}
{{ end }}
@blinkinglight
blinkinglight / yubikey4-ssh-macos.md
Created July 22, 2023 06:28 — forked from ixdy/yubikey4-ssh-macos.md
Setting up ssh public key authentication on macOS using a YubiKey 4

Setting up ssh public key authentication on macOS using a YubiKey 4

I largely followed Florin's blog post, but have a few notes to add regarding issues I encountered:

Basic setup notes

  1. I used a YubiKey 4, while the blog describes using a YubiKey NEO. I'm sure a YubiKey 5 would also work. I'm also running macOS 10.13.6.
  2. I installed GPGTools as recommended. However, as I'll note later, it seems that gpg-agent only automatically starts when gpg is used; for ssh, you'll need to ensure it's running.
  3. Before generating your keys, decide what key size you want to use. If you run the list command inside gpg --edit-card, look for the Key attributes line to see what is currently selected. On my YubiKey 4, it defaulted to 2048 bits for all keys:
Key attributes ...: rsa2048 rsa2048 rsa2048
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine