Skip to content

Instantly share code, notes, and snippets.

View michaelneu's full-sized avatar
Build failed

Michael Neu michaelneu

Build failed
View GitHub Profile
@michaelneu
michaelneu / diff.py
Created March 8, 2019 18:24
Graphically diff similar images
#!/usr/bin/env python3
from PIL import Image
def diff(image_a, image_b):
pixels_a = image_a.load()
pixels_b = image_b.load()
width_a, height_a = image_a.size
width_b, height_b = image_b.size
@michaelneu
michaelneu / proxy.py
Created March 19, 2019 01:13
Basic relay proxy in Python
#!/usr/bin/env python3
import threading
import socket
class Relay(threading.Thread):
def __init__(self, stop_listening, socket_a, socket_b, direction_indicator):
super().__init__()
self._stop_listening = stop_listening
self._socket_a = socket_a
self._socket_b = socket_b
@michaelneu
michaelneu / Makefile
Last active March 23, 2019 00:02
Docker configuration to run wildfly, mysql, maven and phpmyadmin in containers
all: war deploy
deploy:
cp project/target/*.war deployments/
clean:
rm deployments/*.war
docker run --rm -v `pwd`/project:/app -v m2:/root/.m2 -w /app maven:alpine mvn clean
war:
@michaelneu
michaelneu / docker-tags.py
Created April 3, 2019 19:54
Fetch all tags from a Docker image
#!/usr/bin/env python3
import requests
import sys
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: python3 docker-tags.py IMAGE")
exit(1)
<!DOCTYPE html>
<html>
<head>
<title>a</title>
</head>
<body>
<video playsinline autoplay></video>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
@michaelneu
michaelneu / Program.cs
Created July 6, 2019 21:20
Auto clicker for Starbound during the Steam summer sale. Works in the background, simply launch Starbound, spawn sodas and you're good to go.
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
namespace ConsoleClicker
{
class Program
{
@michaelneu
michaelneu / upload.py
Created August 26, 2019 11:18
Quickly create an HTTP upload form to drop files on your machine.
from flask import Flask, request
from werkzeug import secure_filename
app = Flask(__name__)
@app.route("/", methods=["GET"])
def index():
return """<!doctype html>
<html>
<body>
@michaelneu
michaelneu / convert-pdf-to-png.sh
Created September 15, 2019 00:48
Converts all PDFs in the current folder to high-res PNGs.
#!/bin/bash
for pdf in *.pdf; do
png_name="${pdf%.pdf}.png"
echo "converting '$pdf' to '$png_name'"
convert -density 300 "$pdf" -background white -alpha remove -alpha off "$png_name"
done
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
filename = sys.argv[1] if len(sys.argv) == 2 else "main.wasm"
print("[*] Reading", filename)
with open(filename, "rb") as content_fh:
content = content_fh.read()
@michaelneu
michaelneu / .dockerignore
Last active February 3, 2020 17:24
A script to build esp-idf projects inside a Docker - with writable /dev/ttyUSB* mounted inside the container
build/
test/build/