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 / free-vscode-memory.sh
Created April 30, 2020 20:11
vscode C++ tools keep hogging memory, even though IntelliSense is configured to 1GB. Start this script and get notified when it kills the language server, before your system gets unusable
#!/bin/bash
function warn {
i3-nagbar -t warning -m 'killed vscode cpp language server' > /dev/null
}
function kill_leak {
memory_leak=$(ps -eo pmem,pid,cmd | sort -k1 -nr | head -n1)
if [[ $memory_leak == *"cpptools-srv"* ]]; then
@michaelneu
michaelneu / hide.css
Created April 9, 2020 15:57
A Chrome extension to remove the menubar from the Slack webapp.
.p-client.p-client--ia-top-nav {
grid-template-rows: 0 auto min-content;
}
.p-client.p-client--ia-top-nav > .p-top_nav {
opacity: 0.1;
}
.p-client.p-client--ia-top-nav > .p-top_nav:hover {
opacity: 1;
#!/bin/bash
which inotifywait 2>/dev/null > /dev/null
if [[ $? != 0 ]]; then
echo "can't listen for events, install inotify-tools first"
exit 1
fi
directories=""
@michaelneu
michaelneu / README.md
Last active February 23, 2020 00:19
A bookmarklet to view the page source on iOS Safari - without sending your URL to a third party service.

view-source on iOS Safari - without 3rd party services

A bookmarklet to display the current page's HTML in a new tab. Supports HTML syntax highlighting and indentation, JavaScript keywords will be highlighted, too.

Installation

Before adding the bookmarklet, you need to either build view-source.js, or copy view-source.min.js to your clipboard, as we'll paste this into the bookmarklet later.

Safari apparently doesn't support adding a custom bookmarklet, so you'll need to follow these steps:

@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/
#!/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 / 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
@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 / 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
{
<!DOCTYPE html>
<html>
<head>
<title>a</title>
</head>
<body>
<video playsinline autoplay></video>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>