Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Van de Gejuchte chrisvdg

View GitHub Profile
@chrisvdg
chrisvdg / testPydanticList.py
Created May 19, 2022
Test script that shows default empty list of Pydantic does a deep copy
View testPydanticList.py
from dataclasses import field
from typing import List
from pydantic import BaseModel, Field
class ClassWithList(BaseModel):
list: List = Field([], description="A list field")
a = ClassWithList()
b = ClassWithList()
View run_all_methods_of_class.go
package main
import (
"fmt"
"reflect"
)
type My struct{}
func (m My) MyFunc(name string) {
View bananabread.md

Banana Bread

This recipe bakes 2 rectangular cake tins (~23x13cm base)

Ingredients

360g all-purpose flour
2.5 teaspoons baking soda
1.25 teaspoons salt
400g dark brown sugar

@chrisvdg
chrisvdg / swap.sh
Created Mar 13, 2020
Swap stereo Ubuntu
View swap.sh
pactl load-module module-remap-sink \
sink_name=reverse-stereo \
master=0 \
channels=2 \
master_channel_map=front-right,front-left \
channel_map=front-left,front-right
View oidc.go
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"net/http"
"golang.org/x/oauth2"
@chrisvdg
chrisvdg / git.md
Last active Apr 25, 2019
Git notes
View git.md
  • get updates from branch (-r puts your commits on top of the pull, don't do this if you're not the only one working on the branch)

    git pull -r
    
  • push local commit

    git push origin <branch>
    
  • create new branch (and switch to it)

@chrisvdg
chrisvdg / main.go
Last active Oct 6, 2017
Updating a channel every 5 messages
View main.go
// https://play.golang.org/p/PWQlSox72E
package main
import (
"context"
"fmt"
"strconv"
"time"
)
@chrisvdg
chrisvdg / gorm_test.go
Created Sep 26, 2017
Crude example metadata storage fs with Gorm and Cockroach db
View gorm_test.go
package testcockroach
import (
"fmt"
"log"
"testing"
// Import GORM-related packages.
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
@chrisvdg
chrisvdg / install-golang-armv6.sh
Last active Jun 2, 2020
Golang installation scripts
View install-golang-armv6.sh
#!/bin/bash
GOVersion="1.14.3"
echo "Removing go if already present"
rm -dr /usr/local/go
echo "Downloading Go"
wget -O go.tar.gz https://storage.googleapis.com/golang/go$GOVersion.linux-armv6l.tar.gz
echo "Extracting Go"
sudo tar -C /usr/local -xzf go.tar.gz
@chrisvdg
chrisvdg / main.go
Last active Mar 14, 2018
Get IYO JWT
View main.go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)