Skip to content

Instantly share code, notes, and snippets.

Avatar
Build failed

Michael Neu michaelneu

Build failed
View GitHub Profile
@michaelneu
michaelneu / free-vscode-memory.sh
Created Apr 30, 2020
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
View free-vscode-memory.sh
#!/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 Apr 9, 2020
A Chrome extension to remove the menubar from the Slack webapp.
View hide.css
.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;
View simple-watchman.sh
#!/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 Feb 23, 2020
A bookmarklet to view the page source on iOS Safari - without sending your URL to a third party service.
View README.md

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 Feb 3, 2020
A script to build esp-idf projects inside a Docker - with writable /dev/ttyUSB* mounted inside the container
View .dockerignore
build/
test/build/
View convert-bytes-to-header.py
#!/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 Sep 15, 2019
Converts all PDFs in the current folder to high-res PNGs.
View convert-pdf-to-png.sh
#!/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 Aug 26, 2019
Quickly create an HTTP upload form to drop files on your machine.
View upload.py
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 Jul 6, 2019
Auto clicker for Starbound during the Steam summer sale. Works in the background, simply launch Starbound, spawn sodas and you're good to go.
View Program.cs
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
namespace ConsoleClicker
{
class Program
{
View a.html
<!DOCTYPE html>
<html>
<head>
<title>a</title>
</head>
<body>
<video playsinline autoplay></video>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>