Skip to content

Instantly share code, notes, and snippets.

View GhostofGoes's full-sized avatar

Chris Goes GhostofGoes

  • New Mexico, USA
  • 21:34 (UTC -06:00)
View GitHub Profile
@GhostofGoes
GhostofGoes / pyproject.toml
Last active January 31, 2024 00:46
Example pyproject.toml
# This example pyproject.toml is for a basic pip+setuptools setup.
# If you use a project management tool (like Poetry), then
# those tools will have slightly different configurations or additions.
# I highly recommend using a project management tool for your project.
# Project management is a highly opinionated subject.
# There are a lot of good, robust tools in this space now (as of 2023)
# Two that I've used and recommend are Poetry and PDM.
# Poetry is more mature, PDM is recent, both work well.
# - Poetry: https://python-poetry.org/
#!/usr/bin/env python3
"""Velocioraptor. rawr."""
# TODO: improve resiliency to unexpected format changes/deviations
# TODO: generate modbus register/tag map
# TODO: generate input to a scanning script (what that looks like is TBD)
import xml.etree.ElementTree as ET
from pathlib import Path
@GhostofGoes
GhostofGoes / .editorconfig
Last active March 22, 2019 03:29
Base .editorconfig for use in various projects of mine. https://editorconfig.org/
# https://editorconfig.org/
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
[*.py]
@GhostofGoes
GhostofGoes / clean.ps1
Created March 8, 2019 04:29
Cleanup Python artifacts
Remove-Item .\getmac\ -ErrorAction SilentlyContinue -Recurse -Include *.pyc
Remove-Item .\getmac\ -ErrorAction SilentlyContinue -Recurse -Include *.pyo
Remove-Item .\getmac\ -ErrorAction SilentlyContinue -Recurse -Force -Include '__pycache__'
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse .\build\
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse .\dist\
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse *.egg
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse *.egg-info
Remove-Item -ErrorAction SilentlyContinue -Force -Recurse .\.tox\
@GhostofGoes
GhostofGoes / ap.py
Created February 1, 2019 04:41
Simple export for Anime-Planet
import logging
import re
import browsercookie
import requests
from bs4 import BeautifulSoup
from requests.cookies import RequestsCookieJar
class AnimePlanet:
@GhostofGoes
GhostofGoes / virtualenvs.md
Created January 25, 2019 05:02
Create Python virtual environments on Windows and Linux with Virtualenv

Linux/OSX (Bash)

python -m pip install --user -U virtualenv
mkdir -p ~/.virtualenvs/
python -m virtualenv ~/.virtualenvs/getmac
source ~/.virtualenvs/getmac/bin/activate

Windows (PowerShell)

@GhostofGoes
GhostofGoes / mac_addrs.py
Last active November 13, 2023 13:00
Get MAC addresses using a variety of Python packages.
# **************************************
# ** Get MAC address of a remote host **
def arpreq_ip(ip):
# type: (str) -> Optional[str]
import arpreq
return arpreq.arpreq('192.168.1.1')
def scapy_ip(ip):
# type: (str) -> str
"""Requires root permissions on POSIX platforms.
@GhostofGoes
GhostofGoes / .gitignore
Created November 24, 2018 17:08
Global GitIgnore
# Pre-commit config (https://pre-commit.com/)
.pre-commit-config.yaml
# Editors/IDEs/etc
.idea
.vscode
.vagrant
.classpath
.project
@GhostofGoes
GhostofGoes / .pylintrc
Last active October 2, 2022 08:07
PyLint configuration for Google Python Code Style Guide. Slightly modified version of this: https://raw.githubusercontent.com/google/seq2seq/master/pylintrc
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not
@GhostofGoes
GhostofGoes / profile.ps1
Last active November 18, 2018 21:01
PowerShell Profile: "notepad $profile.CurrentUserAllHosts"
# Provides same functionality as the Unix "which" command
function which($commandName)
{
(Get-Command $commandName).Definition
}
# Shortens a filesystem path to singe-characters [used by prompt()].
function shorten-path([string] $path) {
$loc = $path.Replace($HOME, '~')