Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
https://hofstadter.io

Tony Worm verdverm

💭
https://hofstadter.io
View GitHub Profile
@verdverm
verdverm / backup.sh
Created Oct 14, 2020
HN Upvotes Backup and JSONify
View backup.sh
#!/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
Attributes function patch for Cue
View cue-types.go
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 {
View todo.yaml
type:
name: Todo
relations:
- name: tags
type: TodoTag
relation: many-to-many
- name: links
type: TodoLink
@verdverm
verdverm / main.go
Last active Aug 29, 2015
neo4j duplicate, symmetric results
View main.go
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 Oct 25, 2017
neo4j / neoism example
View create.go
package main
import (
"fmt"
"github.com/jmcvetta/neoism"
"github.com/verdverm/neo4j-tutorials/common/reset"
)
var (
db *neoism.Database
@verdverm
verdverm / sympathWalk.go
Created Jul 29, 2014
symlink'n filepath.Walk --- draft
View sympathWalk.go
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 Aug 29, 2015
Revel Dockerfile
View 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