Skip to content

Instantly share code, notes, and snippets.

Avatar
🎹
Hammer time

thebabush thebabush

🎹
Hammer time
View GitHub Profile
@thebabush
thebabush / fix-drawio-svg.py
Created Nov 25, 2020
If you created a diagram using draw.io and now only web browsers can display it somewhat correctly, use this script + manual inkscape editing to fix them.
View fix-drawio-svg.py
#!/usr/bin/env python3
"""
draw.io uses foreignObject tags to put fancy text on SVGs.
The structure it creates is like this:
```
<switch>
<foreignObject>...</foreignObject>
<text>...</text>
@thebabush
thebabush / merge.sh
Last active Jun 10, 2020
bash/python one-liner to merge all compile_commands.json files in a directory tree
View merge.sh
python3 -c 'import json; import glob; import itertools; print(json.dumps(list(itertools.chain(*[json.load(open(f, "rb")) for f in glob.glob("**/compile_commands.json", recursive=True)])), indent=4))' > ../compile_commands.json
@thebabush
thebabush / 00 contents
Created Apr 3, 2020 — forked from jasonk000/00 contents
improve jitdump support when mmap'd jit region expands for kdab hotspot & perf
View 00 contents
Linux perf fixes
01 overview
02 patch to make linux perf report work cleanly with jitdump remap
03 perf script for sample input file showing mmap overwrite
04 perf report before example
05 perf report after example
--
KDAB Hotspot specific fixes
06 patch to make linux perf output output program headers for KDAB hotspot
07 patch to make hotspot UI load cleanly with jitdump remap
@thebabush
thebabush / vigorun.py
Created Mar 28, 2020
Vigorun Python Example
View vigorun.py
#!/usr/bin/env python3
import pygatt
"""
adc <= 1000
age <= 120
heigth <= 269
weight <= 220
View CVE-2019-16160.txt
[Suggested description]
An integer underflow in the SMB server of MikroTik RouterOS 6.43.16
(x86 and CHR) allows remote unauthenticated attackers to crash the
service.
------------------------------------------
[Additional Information]
The vulnerability likely affects other versions too.
The vulnerability might be exploitable to achieve RCE.
@thebabush
thebabush / spidermonkey.yml
Last active Sep 27, 2019
Firefox/SpiderMonkey Code Cache Parser
View spidermonkey.yml
meta:
id: spidermonkey
endian: le
seq:
- id: build_id_length
type: u4
- id: build_id
type: str
View translate_str.py
#!/usr/bin/env python3
"""
Quick'n'dirty script to translate subs using Yandex.
It all started because I didn't have enough time to finish a Japanese movie
that I was watching heading back home from DEF CON 27.
Anyway, I managed to get a copy of the movie (**cough cough**) but my 日本語
is really bad and the only subs I could find were in Chinese.
So I decided to bear the automatic translation for the remaining 30 minutes
@thebabush
thebabush / dumb_ideas.md
Last active Apr 3, 2018
Dumb programming ideas for free
View dumb_ideas.md

Dumb programming ideas for free

So, here's a list of stuff that might be useful but I never implemented.

Jupyter notebook graph interface

The basic idea is to have a graph view instead of a linear one.

Ideas:

@thebabush
thebabush / ipython_cython_embed.py
Last active Feb 22, 2018
Run IPython.embed() inside Cython
View ipython_cython_embed.py
# Cython/pyximport don't work 100% with the `inspect` module.
# For this reason, `IPython.embed()` is not able to get the locals from the current frame.
# This is how to work around that
import IPython
def embed(locs):
# Pass the locals explicitly
IPython.embed(user_ns=locs)
@thebabush
thebabush / wav2mp3.bat
Created Sep 27, 2017
Convert all WAVs in a directory to MP3s (VBR 150/195 kbps) using ffmpeg on windows
View wav2mp3.bat
REM Put this file in a directory and double click on it
REM Some details:
REM - ffmpeg must be in the system PATH
REM - you can change the bitrate easily by changing the "q" parameter (https://trac.ffmpeg.org/wiki/Encode/MP3)
for /f "tokens=1 delims=." %%a in ('dir /B *.wav') do ffmpeg -i "%%a.wav" -q:a 3 "%%a.mp3"