Skip to content

Instantly share code, notes, and snippets.

View mie00's full-sized avatar

Mohamed I. Elawadi mie00

View GitHub Profile
#!/usr/bin/env python3
"""
Room Acoustics Testing Tool
Test different acoustic foam placements by playing test signals
and analyzing the room's response. Compare multiple sessions to
find the optimal treatment configuration.
Usage:
python room_acoustics_test.py devices
import os
import random
import sqlite3
import sys
import uuid
from flask import (Flask, redirect, render_template_string, request,
send_from_directory)
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
@mie00
mie00 / ffmpeg_runner
Last active November 4, 2021 19:28
tool to run ffmpeg for audio, video merging, scaling, subtitles adding
#!/usr/bin/env python3
# usage: eval `./runner.py VID_20200321_142302.mp4 Recording_9.m4a 0 00:01:40.76 45.2 p3oc.mp4 s3.srt`
import sys
import os
import tempfile
if len(sys.argv) not in [7, 8]:
print("runner has to run with `runner <video> <audio> <start> <end> <audio_trim> <output> [<subtitle file>]`")
@mie00
mie00 / taxes20192020nl.py
Created February 18, 2020 09:22
calculate taxes in the netherlands for 2019-2020
#2019
def labor2(x):
if x <= 9694:
return 0.01754 * x
elif x <= 34060:
return min(3399.0, 0.01754 * 9694 + 0.28712 * (x - 9694))
elif x <= 90710:
return 3399.0 - 0.06 * (x - 34060)
else:
#!/bin/bash
MAC='0C:62:A6:13:4A:8A'
IP='192.168.178.13'
[ "$#" == 0 ] && echo 'missing argument, can be one of on, off, toggle' >&2 && exit 1
on () {
echo "turning on"
python "$HOME"/.bin/wowlan.py $MAC
@mie00
mie00 / trip.html
Last active December 24, 2020 10:47
plotting an entire trip using location history from google and google maps javascript api
<!DOCTYPE html>
<html>
<!--
usage:
1. install jq for json parsing.
2. go here https://takeout.google.com/settings/takeout and download "Location history" in json format and save it as location.json.
3. run `cat location.json|jq '.locations | map(select(has("accuracy"))) | map({lat: (.latitudeE7 / 10000000), lng: (.longitudeE7 / 10000000), accuracy: .accuracy, timestamp: (.timestampMs | tonumber / 1000)})' > google.json`
4. cp google.json google.js.
5. add `var points = ` to the beginning of google.js file `sed -i '1s/^/var points = /' google.js`.
@mie00
mie00 / cnc.bash
Last active April 14, 2019 04:23
Check internet connection script
#!/bin/bash
export COLOR_NC='\e[0m'
export COLOR_GREEN='\e[0;32m'
export COLOR_RED='\e[0;31m'
export INTERFACE='wlp3s0'
if [ "`nmcli networking`" == "enabled" ]; then
printf "${COLOR_GREEN}networking enabled${COLOR_NC}\n"
else
@mie00
mie00 / mon.sh
Last active September 6, 2018 14:08
A script to dump data from and to your service
#!/bin/bash
# Usage: ./my-service --listen=127.0.0.1:`mon 8080`
PORT=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 ))
echo "$PORT"
socat -v TCP4-LISTEN:"$1",bind=127.0.0.1,reuseaddr,fork TCP4:"${2:-127.0.0.1}":$PORT >&2 & !
// ==UserScript==
// @name random_order
// @namespace elmenus
// @description randomise order
// @include https://www.elmenus.com/*
// @version 1
// @grant none
// @authors Mohamed Elawadi <mohamed@elawadi.net>
// ==/UserScript==
(function() {
package main
import (
"crypto/salsa20"
"crypto/sha512"
"encoding/binary"
"unsafe"
)
const (