Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
@olekukonko
olekukonko / Convert audio to video with ffmpeg - examples.md
Created August 5, 2020 08:47 — forked from CannonballSkippy/Convert audio to video with ffmpeg - examples.md
A list of examples on how you can use filters to make visual representations of audio using ffmpeg

Convert audio to video with ffmpeg - examples

ffmpeg -i input.mp3 -filter_complex "[0:a]avectorscope=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a avectorscope.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showcqt=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showcqt.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]ahistogram=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a ahistogram.mp4
@olekukonko
olekukonko / ffmpeg.md
Created July 1, 2020 02:58 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtGFiUi6YgOC/MHX/dn6Zm1Q7DLf3GBdb3PzydCLYgsAMCqS/optBwetSgwz1euTTyZgCvZk8Qv1QlwvgRTNlonuntDZr0DE9qLjMk6qW5AnvWLkzKU0Vuiie/slPNNJw6RwT5g8E+G6bXjKw0pibv80lK25RHrF8497WFS5oxszBJEjYDAMdifPhwJbSJDvEfwcgn8xIMKyAuC0I83UJFSiN4Z5dEzqwWVy/EP7qjOBAnoSNwHG49NnKC+qwHv+As0lRCGEqDHxtk2f2wWEaGQOKr5JmtjX9yiE0mjWU+sjhB9/Is5oMgvz+xCup7Wpbs8CEkVBZwe7XbURXuDWhj [email protected]
@olekukonko
olekukonko / README.txt
Created May 1, 2020 19:58 — forked from ncw/README.txt
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh [email protected]
Run the server in one terminal
go run server.go
@olekukonko
olekukonko / sql.go
Created April 15, 2020 05:00 — forked from PumpkinSeed/sql.go
Extension for sql package
func structScan(rows *sql.Rows, model interface{}) error {
v := reflect.ValueOf(model)
if v.Kind() != reflect.Ptr {
return errors.New("must pass a pointer, not a value, to StructScan destination") // @todo add new error message
}
v = reflect.Indirect(v)
t := v.Type()
cols, _ := rows.Columns()
@olekukonko
olekukonko / go-worker.go
Created February 28, 2020 16:35 — forked from System-Glitch/go-worker.go
A resilient service worker written in Go
package main
// This is an example of a resilient service worker program written in Go.
//
// This program will run a worker, wait 5 seconds, and run it again.
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work
// is finished before exiting.
//
// Unexpected panics are also handled: program won't crash if the worker panics.
// However, panics in goroutines started by the worker won't be handled and have
@olekukonko
olekukonko / bank.go
Created December 9, 2017 22:24 — forked from iamxy/bank-test.go
// Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@olekukonko
olekukonko / tx.go
Created September 17, 2017 10:33 — forked from lyoshenka/tx.go
A simple, neat way to wrap code in an sql transaction with proper committing/rollbacking and error handling.
// TxFunc is a function that can be wrapped in a transaction
type TxFunc func(tx *sql.Tx) error
// WithTx wraps a function in an sql transaction. After the function returns, the transaction is
// committed if there's no error, or rolled back if there is one.
func WithTx(db *sql.DB, f TxFunc) (err error) {
tx, err := db.Begin()
if err != nil {
return err
}
@olekukonko
olekukonko / trust.go
Created September 8, 2017 09:57
Trusting Local Certificate
package main
import (
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)