Skip to content

Instantly share code, notes, and snippets.

View bbayles's full-sized avatar

Bo Bayles bbayles

View GitHub Profile
@bbayles
bbayles / burning_rangers_action_replay.md
Last active February 17, 2023 13:37
Pro Action Replay codes for Burning Rangers and related Saturn discs

These codes are from the Burning Rangers hacking guide. Get in touch if you've got more!

The ss.cht file that's included here is for use with the Mednafen emulator. You can try to use it directly, but your disc image backups may have different hashes than mine. I would do this:

  1. Open your game with Mednafen
  2. Press Alt+C to open the Cheats console
  3. Enter 2 for Cheat Search
  4. Enter 1 to Add Cheat
  5. Fill out the form for a dummy cheat
  6. Close Medafen
  7. Open the ss.cht file and add my lines to your file
"""Burning Rangers Taikenben editor.
Modifies the .bin file with the main game on it to play additional missions.
Expects an input file (before modification) with the SHA-1 hash
acdb237c6c6fa34f6f6bdab767e88f15a6670d6b.
"""
from argparse import ArgumentParser
parser = ArgumentParser('Modify Burning Rangers Taikenben')
parser.add_argument('file_path', type=str, help='Path to first .bin file')
parser.add_argument('round_number', type=int, help='Which round to load')
@bbayles
bbayles / brangers.py
Last active January 3, 2023 17:33
Burning Rangers password functions
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ123456'
XOR_CONSTANT = 0x9fd43b75
def from_binary(all_bits):
# Given a string of 50 '0' and '1' characters, return a 10 character password string
ret = []
for i in range(5, len(all_bits) + 1, 5):
j = int(all_bits[i - 5:i], 2)
ret.append(ALPHABET[j])
"""Quick and dirty HLS transport stream downloader.
Give it a URI that points to a media playlist (one that contains transport stream URIs,
not a multivariant playlist that contains other playlist URIs).
It will read the playlist, download all the segments, and write them to your chosen
output location.
A single output file is created. This works because MPEG Transport Stream files
can be concatenated.
"""
from argparse import ArgumentParser
from concurrent.futures import ThreadPoolExecutor
from gzip import open as gz_open
from boto3 import client as boto3_client
def get_lengths(bucket, key, open_func=gz_open, s3_client=None, chunk_size=8192):
s3_client = s3_client or boto3_client('s3')
resp = s3_client.get_object(Bucket=bucket, Key=key)
uncompressed_length = 0
with open_func(resp['Body'], mode='rb') as f:
for chunk in iter(lambda: f.read(chunk_size), b''):
@bbayles
bbayles / README.txt
Last active July 21, 2019 18:22
Rename SWC Sensor on first boot
Create the two files (sudo nano <filename>):
* /opt/obsrvbl-ona/set_ona_name.sh
* /etc/systemd/system/set_ona_name.service
Make the first script executable:
sudo chmod +x /opt/obsrvbl-ona/set_ona_name.sh
Enable the service:
sudo systemctl enable set_ona_name.service
@bbayles
bbayles / swc_lambda_poll.py
Last active August 14, 2019 12:57
Poll SWC for new alerts and observations
"""
swc_lambda_poll.py
Use this AWS Lambda function with a Cloudwatch Logs Event to poll
for and react to Stealthwatch Cloud alerts.
The Cloudwatch Logs Event should trigger every 10 minutes.
"""
from datetime import datetime, timedelta, timezone
from os import environ
from botocore.vendored import requests
from itertools import chain, islice, tee
from more_itertools import consume
_marker = object()
class iterchunked:
def __init__(self, iterable, n):
self._source = iter(iterable)
from datetime import datetime, timedelta
from functools import total_ordering
@total_ordering
class dt_range:
def __init__(self, start_dt, end_dt):
if start_dt > end_dt:
raise ValueError('start_dt must be before end_dt')
@bbayles
bbayles / download_observations.py
Created April 2, 2019 20:08
Download observations from Stealthwatch Cloud and print them as CSV
#!/usr/bin/env python3
from argparse import ArgumentParser
from csv import DictWriter
from requests import get
from sys import stdout
LIMIT = 1000
def main(tenant, observation_type, user, key, max_count=10000):