Skip to content

Instantly share code, notes, and snippets.

@verdverm
verdverm / dagger in dagger
Last active July 8, 2023 22:31
Dagger in Dagger with the Go SDK
go mod init hof.io/inception
go mod tidy
go run main.go
@verdverm
verdverm / guidance.go
Last active May 18, 2023 20:03
Guidance in Go
package main
import (
"bytes"
"fmt"
"os"
"text/template"
)
var tmpl = `
@verdverm
verdverm / backup.sh
Created October 14, 2020 18:49
HN Upvotes Backup and JSONify
#!/usr/bin/env bash
set -euo pipefail
COOKIE="user=verdverm&..."
USERNAME="verdverm"
BASEURL="https://news.ycombinator.com/upvoted"
PAGE=0
mkdir -p html
@verdverm
verdverm / cue-types.go
Created May 20, 2020 21:21
Attributes function patch for Cue
func (v Value) Attributes() map[string]Attribute {
attrs := map[string]Attribute{}
// return empty
if v.path == nil || v.path.attrs == nil {
return attrs
}
// collect attribues
for _, a := range v.path.attrs.attr {
type:
name: Todo
relations:
- name: tags
type: TodoTag
relation: many-to-many
- name: links
type: TodoLink
@verdverm
verdverm / main.go
Last active August 29, 2015 14:05
neo4j duplicate, symmetric results
func findLovers() {
stmt := `
MATCH
(u1:User)-[:LOVES]->(u2:User)-[:LOVES]->(u1)
WHERE u1.name <= u2.name // <- THIS WAS MISSING
RETURN u1.name, u2.name
ORDER BY u1.name, u2.name
`
res := []struct {
@verdverm
verdverm / create.go
Last active October 25, 2017 23:22
neo4j / neoism example
package main
import (
"fmt"
"github.com/jmcvetta/neoism"
"github.com/verdverm/neo4j-tutorials/common/reset"
)
var (
db *neoism.Database
@verdverm
verdverm / sympathWalk.go
Created July 29, 2014 03:26
symlink'n filepath.Walk --- draft
func sympathWalk(path string) {
// for now... (so i don't have to change everything below)
p := path
// is the directory / file a symlink?
f, err := os.Lstat(p)
if err == nil && f.Mode()&os.ModeSymlink == os.ModeSymlink {
realPath, err := filepath.EvalSymlinks(p)
if err != nil {
@verdverm
verdverm / Dockerfile
Last active August 29, 2015 14:04
Revel Dockerfile
FROM google/golang:1.3
RUN go get github.com/revel/cmd/revel
VOLUME ["/gopath/src"]
WORKDIR /gopath/src
CMD revel run github.com/revel/revel/samples/chat