Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FakeBook</title>
</head>
<body>

Keybase proof

I hereby claim:

  • I am patrickvienne on github.
  • I am patrickzimt (https://keybase.io/patrickzimt) on keybase.
  • I have a public key ASAGP73Zic0JT3kgt-UGeNVVS6m7xjkdUM6z9ajgbyLv2wo

To claim this, I am signing this object:

@PatrickVienne
PatrickVienne / ringbuffer.go
Created September 17, 2023 15:02
ringbuffer
package ringbuffer_safe
import (
"log"
"os"
"os/signal"
"runtime"
"sync/atomic"
"time"
)
[user]
email = [email protected]
name = PatrickVienne
[push]
default = upstream
[core]
trustctime = false
editor = vim
autocrlf = input
filemode = false
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
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 rand7
import (
"math/rand"
"testing"
)
func rand5() int {
return rand.Intn(5) + 1
}
@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
@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 / aoc2023_d2.go
Created December 2, 2023 06:34
Advent Of Code 2023 - Day 2
package d2
import (
"bufio"
"bytes"
"io"
"regexp"
"strconv"
)