Count how many connections are made by a process
netstat -natp | grep "{process name}" | wc -l
Show path of current active processes
ps -ef
*Gen letencrypt cert
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"math" | |
"math/big" | |
"time" |
package main | |
import ( | |
"context" | |
"fmt" | |
"math/big" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/core/types" | |
"github.com/ethereum/go-ethereum/crypto" |
func NewBufferQueue() *BufferQueue { | |
return &BufferQueue{ | |
Q: make(model.Queue, 100), | |
quitRr: make(chan bool, 1), | |
quitWr: make(chan bool, 1), | |
W: &sync.WaitGroup{}, | |
} | |
} | |
type BufferQueue struct { |
[Unit] | |
Description=MongoDB Database Service | |
Wants=network.target | |
After=network.target | |
[Service] | |
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf | |
ExecStop=/usr/bin/mongod -f /etc/mongodb.conf --shutdown | |
Restart=always | |
User=mongodb |
package main | |
import ( | |
"bytes" | |
"database/sql" | |
"encoding/base32" | |
"encoding/binary" | |
"math/rand" | |
"testing" |
[Unit] | |
Description= Video Streaming Proxy | |
[Service] | |
LimitNOFILE=64000 | |
User=ubuntu | |
Group=ubuntu | |
Restart=always | |
WorkingDirectory=/opt/video-proxy | |
ExecStart=/opt/video-proxy/proxy_streaming |
Count how many connections are made by a process
netstat -natp | grep "{process name}" | wc -l
Show path of current active processes
ps -ef
*Gen letencrypt cert
package main | |
import ( | |
"crypto/tls" | |
"log" | |
"math/rand" | |
"syscall" | |
"time" | |
"github.com/canhlinh/log4go" |
package main | |
import ( | |
"database/sql" | |
"time" | |
"log" | |
_ "github.com/go-sql-driver/mysql" | |
"github.com/jinzhu/gorm" |
package main | |
import ( | |
"fmt" | |
"runtime" | |
// "runtime/debug" | |
) | |
func foo(m *runtime.MemStats) { | |
runtime.ReadMemStats(m) |