Skip to content

Instantly share code, notes, and snippets.

@PatrickVienne
PatrickVienne / Net Zero by 2050 - A Roadmap for the Global Energy Sector_p202_transformed.csv
Created April 13, 2024 14:42
Generate historical animation for Nuclear and Renewable Energy Share of Energy Production
EnergyType Financing Rate Costtype Region 2020 2030 2050
Nuclear 8 Capital costs ($/kW) United States 5000 4800 4500
Coal 8 Capital costs ($/kW) United States 2100 2100 2100
Gas CCGT 8 Capital costs ($/kW) United States 1000 1000 1000
Solar PV 3.7 Capital costs ($/kW) United States 1140 620 420
Wind onshore 3.7 Capital costs ($/kW) United States 1540 1420 1320
Wind offshore 4.5 Capital costs ($/kW) United States 4040 2080 1480
Nuclear 8 Capital costs ($/kW) European Union 6600 5100 4500
Coal 8 Capital costs ($/kW) European Union 2000 2000 2000
Gas CCGT 8 Capital costs ($/kW) European Union 1000 1000 1000
@PatrickVienne
PatrickVienne / aoc2023_d3.go
Created December 3, 2023 06:21
Advent of Code 2023 - Day 3
package d3
import (
"bufio"
"io"
"regexp"
"strconv"
)
func Must(err error) {
@PatrickVienne
PatrickVienne / aoc2023_d2.go
Created December 2, 2023 06:34
Advent Of Code 2023 - Day 2
package d2
import (
"bufio"
"bytes"
"io"
"regexp"
"strconv"
)
@PatrickVienne
PatrickVienne / aoc2023_d1.go
Created December 1, 2023 07:22
AOC2023-D1
package d1
import (
"bufio"
"io"
"regexp"
"unicode/utf8"
)
func Must(err error) {
@PatrickVienne
PatrickVienne / leetcode_27_remove_element.go
Created October 15, 2023 15:04
leetcode_27_remove_element.go
// https://leetcode.com/problems/remove-element/description/
func removeElement(nums []int, val int) int {
if len(nums) == 0 {
return 0
}
writeptr := len(nums)-1
readptr := 0
// replace val with number from the back
package rand7
import (
"math/rand"
"testing"
)
func rand5() int {
return rand.Intn(5) + 1
}
package towerofseven
import (
"testing"
)
// greatest power of seven within the range of int32
const sevenPowEleven = 1977326743
// returns whether an integer number 'n' == 7**int(x) (a positive integer power of 7)
package towerofsevens
/*
Task:
Find a fast way, to determine whether a number (any int32 integer) is a power of 7?
Example Input and Output:
TowerOfSevens(-7) -> false
TowerOfSevens(0) -> false
TowerOfSevens(1) -> true
[user]
email = [email protected]
name = PatrickVienne
[push]
default = upstream
[core]
trustctime = false
editor = vim
autocrlf = input
filemode = false
@PatrickVienne
PatrickVienne / ringbuffer.go
Created September 17, 2023 15:02
ringbuffer
package ringbuffer_safe
import (
"log"
"os"
"os/signal"
"runtime"
"sync/atomic"
"time"
)