Skip to content

Instantly share code, notes, and snippets.

View m99coder's full-sized avatar

Marco Lehmann m99coder

View GitHub Profile
@m99coder
m99coder / m3u8-to-mp4.md
Created January 30, 2018 11:05 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@m99coder
m99coder / .gitconfig
Created February 2, 2021 11:10 — forked from asaaki/.gitconfig
Using different emails and GPG keys for work and personal stuff on GitHub
[core]
# ...
[init]
defaultBranch = main
[commit]
gpgsign = true
# you want that to have a default for locations outside of your regular dev folders
@m99coder
m99coder / Dockerfile
Last active April 12, 2023 08:57
Redis Replication with Docker Compose and Kubernetes Kompose
FROM redis:6.0.10
@m99coder
m99coder / slices.go
Created March 9, 2021 17:35
2D slices in Go
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
r := make([][]uint8, dy)
for y := range r {
r[y] = make([]uint8, dx)
for x := range r[y] {
// different functions to generate the “picture”
@m99coder
m99coder / errors.go
Created March 10, 2021 10:59
Value receiver method for Error interface
package main
import (
"fmt"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
return fmt.Sprintf("cannot Sqrt negative number %d", int(e))
@m99coder
m99coder / readers.go
Created March 10, 2021 11:06
Reader with infinite stream of ASCII character 'A'
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
func (r MyReader) Read(b []byte) (int, error) {
for i := range b {
b[i] = 65
}
@m99coder
m99coder / rot13reader.go
Created March 10, 2021 11:13
Transform Reader: Rot13
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
@m99coder
m99coder / images.go
Created March 10, 2021 11:24
Image interface
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct {
w, h int
@m99coder
m99coder / equivalent_trees.go
Last active March 10, 2021 12:32
Concurrency and channels to walk binary trees
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
func Walk(t *tree.Tree, ch chan int) {
defer close(ch)
// using a closure
@m99coder
m99coder / web_crawler.go
Created March 10, 2021 12:44
Mutual exclusion with mutex
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.