Skip to content

Instantly share code, notes, and snippets.

@Semnodime
Semnodime / ANSI.md
Created May 6, 2024 10:54 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@Semnodime
Semnodime / pdf_flatedecode.py
Last active March 31, 2024 20:07 — forked from averagesecurityguy/pdf_flatedecode.py
Decompress FlateDecode Objects in PDF
#!/usr/bin/env python3
import re
import sys
import zlib
def main(filename:str):
"""This script will find each FlateDecode stream in the given PDF document using a regular expression, unzip it, and print out the unzipped data."""
with open(filename, 'rb') as pdf_file:
@Semnodime
Semnodime / kmeansExample.py
Last active May 13, 2024 14:02 — forked from iandanforth/kmeansExample.py
A pure python3 compatible implementation of K-Means clustering. Optional cluster visualization using plot.ly.
"""
This is a pure Python3 implementation of the K-means Clustering algorithm.
It is based on a GitHub Gist which uses Python2:
https://gist.github.com/iandanforth/5862470
I have refactored the code and to assure the code obeys Python Enhancement Proposals (PEPs) rules.
After reading through this code you should understand clearly how K-means works.
This script specifically avoids using numpy or other more obscure libraries.
It is meant to be *clear* not fast.
I have also added integration with the plot.ly plotting library.
So you can see the clusters found by this algorithm. To install plotly run: