Skip to content

Instantly share code, notes, and snippets.

@zue666
zue666 / encode.sh
Created April 24, 2017 00:40 — forked from lisamelton/encode.sh
This is the shell script I use to drive HandBrakeCLI to re-encode video files in a format suitable for playback on Apple TV, Roku 3, iOS, OS X, etc.
#!/bin/bash
# encode.sh
#
# Copyright (c) 2013 Don Melton
#
# This version published on June 7, 2013.
#
# Re-encode video files in a format suitable for playback on Apple TV, Roku 3,
# iOS, OS X, etc.
@zue666
zue666 / balance.go
Created March 25, 2018 12:33 — forked from darkhelmet/balance.go
Simple TCP load balancer in Go.
package main
import (
"flag"
"io"
"log"
"net"
"strings"
)
@zue666
zue666 / ws-client.go
Created March 27, 2018 11:05 — forked from diorahman/ws-client.go
golang websocket example with basic auth
package main
import (
"log"
"net/http"
"encoding/json"
"golang.org/x/net/websocket"
"fmt"
)
@zue666
zue666 / proxy_copy.go
Created July 11, 2018 13:54 — forked from jbardin/proxy_copy.go
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@zue666
zue666 / default.conf
Created July 19, 2018 15:45
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@zue666
zue666 / mysql-docker.sh
Created December 10, 2018 22:23 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
package main
import (
"flag"
"log"
"net/http"
"strings"
)
// FileSystem custom file system handler
@zue666
zue666 / gist:2bb13e5708f6faa55db773730e07c441
Created October 18, 2019 10:23 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
package main
import (
"fmt"
"github.com/julienschmidt/httprouter"
"golang.org/x/net/websocket"
"net/http"
"log"
)
@zue666
zue666 / client.go
Created May 8, 2020 22:21 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)