Skip to content

Instantly share code, notes, and snippets.

View chrisvdg's full-sized avatar

Chris Van de Gejuchte chrisvdg

View GitHub Profile
@chrisvdg
chrisvdg / main.py
Created April 18, 2024 11:27
Quick and dirty proxy server to log passing traffic
from fastapi import FastAPI, Request, Response
import secrets
import requests
from datetime import datetime
targetBaseUrl = "http://localhost:5000"
app = FastAPI()
@chrisvdg
chrisvdg / testPydanticList.py
Created May 19, 2022 13:44
Test script that shows default empty list of Pydantic does a deep copy
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()
package main
import (
"fmt"
"reflect"
)
type My struct{}
func (m My) MyFunc(name string) {

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 / install-golang-armv6.sh
Last active June 2, 2020 07:57
Golang installation scripts
#!/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 / swap.sh
Created March 13, 2020 13:21
Swap stereo Ubuntu
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
@chrisvdg
chrisvdg / git.md
Last active April 25, 2019 09:19
Git notes
  • 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)

package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"net/http"
"golang.org/x/oauth2"
@chrisvdg
chrisvdg / main.go
Last active March 14, 2018 09:21
Get IYO JWT
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)
@chrisvdg
chrisvdg / main.go
Last active October 6, 2017 07:13
Updating a channel every 5 messages
// https://play.golang.org/p/PWQlSox72E
package main
import (
"context"
"fmt"
"strconv"
"time"
)