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
@willshiao
willshiao / aes.go
Last active January 10, 2025 18:00
AES 256-CFB in Node.js, Go, and Python
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
package main
import (
agwd "github.com/sclevine/agouti"
tbwd "github.com/tebeka/selenium"
"log"
sgwd "sourcegraph.com/sourcegraph/go-selenium"
)
// Helper for sourcegraph/go-selenium
package main
import (
"bytes"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"sync"
@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'
@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())
@rsyring
rsyring / example.js
Created November 20, 2017 04:44
Mithril Contacts
function Contacts(vn) {
let contacts = [
{name: 'Fred', email: '[email protected]'},
{name: 'Bob', email: '[email protected]'},
]
function addContact(contact) {
contacts.push(contact)
}
@ego008
ego008 / multiple-host-reverse-proxy.go
Last active August 24, 2025 12:18
Multiple host reverse proxy in Go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
var (
@enricofoltran
enricofoltran / main.go
Last active September 30, 2025 12:29
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"
<!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">
@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"