Skip to content

Instantly share code, notes, and snippets.

View alex-ant's full-sized avatar

Aleksandrs Antonovs alex-ant

View GitHub Profile
@alex-ant
alex-ant / aes-encryption.go
Created September 6, 2021 15:36
Encrypt data with AES-256
package encryption
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"fmt"
"io"
)
@alex-ant
alex-ant / replace_variables.go
Created December 16, 2020 06:43
Replace variables "as words" without replacing the prefixes of other ones.
package main
import (
"fmt"
)
func replaceByRange(s string, startIdx, endIdx int, new string) string {
var res string
var replaced bool
@alex-ant
alex-ant / bootstrap-col-sizes
Created April 13, 2018 20:32
Display bootstrap column sizes
<div className="row">
<div className='col-xs-12 hidden-sm hidden-md hidden-lg'>XS</div>
<div className='hidden-xs col-sm-12 hidden-md hidden-lg'>SM</div>
<div className='hidden-xs hidden-sm col-md-12 hidden-lg'>MD</div>
<div className='hidden-xs hidden-sm hidden-md col-lg-12'>LG</div>
</div>
@alex-ant
alex-ant / vertical-text.go
Last active April 6, 2018 13:16
String to vertical text
package main
import (
"fmt"
"strings"
"unicode/utf8"
)
const (
delimiter string = "_"
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)