Skip to content

Instantly share code, notes, and snippets.

View ego008's full-sized avatar
🏠
Working from home

Ybb ego008

🏠
Working from home
View GitHub Profile
@felix021
felix021 / socks5_proxy.go
Created November 21, 2020 08:12
Minimal socks5 proxy implementation in Golang
package main
import (
"encoding/binary"
"errors"
"fmt"
"io"
"net"
)
@c2h2
c2h2 / kcptun_template.sh
Created January 3, 2019 09:02
kcptun template
HOST=yourhost.com:38989
LISTEN=12345 #example port
KEY=your_very_secure_long_long_key
echo $HOST $LISTEN $KEY
#kill first
kill $(ps aux | grep ${LISTEN} | awk '{print $2}');
#main proc
@NHOrus
NHOrus / autocert.go
Created September 18, 2018 07:36
Currently cobbled autocerted file server thingy
package main
import (
"crypto/tls"
"fmt"
"golang.org/x/crypto/acme/autocert"
"io"
"log"
"net/http"
"time"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-rc1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.1/pako.min.js"></script>
</head>
<body>
<form id="my-form">
<input type="file" name="file">
@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@ego008
ego008 / multiple-host-reverse-proxy.go
Last active April 10, 2023 17:41
Multiple host reverse proxy in Go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
var (
@rsyring
rsyring / example.js
Created November 20, 2017 04:44
Mithril Contacts
function Contacts(vn) {
let contacts = [
{name: 'Fred', email: 'fred@example.com'},
{name: 'Bob', email: 'bob@example.com'},
]
function addContact(contact) {
contacts.push(contact)
}
@MichalZalecki
MichalZalecki / docx2pdf.py
Created July 8, 2017 08:09
Converting DOCX to PDF using Python
import sys
import subprocess
import re
def convert_to(folder, source, timeout=None):
args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
filename = re.search('-> (.*?) using filter', process.stdout.decode())
@Greyvend
Greyvend / client.py
Created May 14, 2017 13:51
Tornado TCP Server & Client with Redis connection. Refer to the corresponding repo for the full working example: https://github.com/Databrawl/real_time_tcp/tree/3e01d85e719bf793a4811b2d701609a9a4d36597
from concurrent.futures import ThreadPoolExecutor
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.iostream import StreamClosedError
from tornado.tcpclient import TCPClient
class Client(TCPClient):
msg_separator = b'\r\n'
package main
import (
"bytes"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"sync"