Skip to content

Instantly share code, notes, and snippets.

# Self-signed certificate generator for AWS by Dagen Brock
# The basic instructions come from Amazon:
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl.html
#
# Specifically, you can generate a cert with these 3 commands:
# openssl genrsa 2048 > privatekey.pem
# openssl req -new -key privatekey.pem -out csr.pem
# openssl x509 -req -days 365 -in csr.pem -signkey privatekey.pem -out server.crt
#
# This script walks you through generation and puts them in your specified output dir.
@digarok
digarok / line_dynamic.s
Created July 9, 2019 02:39
An example of wrapping Andy McFadden's 65816 IIgs line drawing code to support arbitrary draw buffer addresses.
MyBuffer = $051800
* Just need to do this once after malloc
InitDrawlines
lda #<MyBuffer ; should be 1800
sta __p0
sta __p1
sta __p2
sta __p3
@digarok
digarok / reset-pw-aws.sh
Created April 9, 2019 14:30
AWS reset users password
aws iam update-login-profile --profile aws-builder-master --user-name JimBob --password "yourpasswordhere"
@digarok
digarok / swell.py
Created February 6, 2019 16:36
This will find EC2 resources across multiple accounts and regions (see CONFIG section). Use like, "python swell.py --find myserver"
import boto3, argparse, prettytable
# CONFIG START - PUT YOUR PROFILE NAMES AND REGIONS TO SCAN HERE
account_profiles=['abc-prod-account', 'abc-staging-account', 'abc-dev-account']
regions=['us-east-1','us-west-2']
# CONFIG END
def match_in_keys(o, keys, match):
m = False
for k in keys:
@digarok
digarok / copytolores.s
Created December 10, 2018 19:10
Copy from some buffer (ReadBuf) to the GR/Text Screen
CopyToGR lda #ReadBuf
sta 0
ldx #0
:nextline lda LoLineTable,x
sta 2
ldy #38
:doline lda (0),y
sta (2),y
dey
@digarok
digarok / grconv.py
Created November 9, 2018 21:20
Convert images to Apple II lores bytes to write directly to memory.
# Take some image and convert to LoRes bytes
# You should already have it in 16 Apple II colors
# but this will do a nearest color match if not.
from PIL import Image
from math import sqrt
img = Image.open("saved_Preview.BMP")
def distance3d((x1, y1, z1), (x2, y2, z2)):
return sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2)
@digarok
digarok / genc1.py
Created October 31, 2018 02:27
Convert (320x200) RGB image to an Apple IIgs $C1 (Uncompressed SHR) file
# Invoke like:
# $ python genc1.py mypic.png output.shr
from PIL import Image
from math import sqrt
from sys import argv
img = Image.open(argv[1])
rgb_img = img.convert("RGB") # create the pixel map
@digarok
digarok / lz4.s
Created October 29, 2018 15:35
LZ4 65816 decompress special format
* Format is : 2-byte length word followed by compressed stream
MX %00
*-------------------------------------------------------------------------------
LZ4_Unpack STY LZ4_DestOffset+1 ; Y = Destination offset
STX LZ4_HeaderLenByte+1 ; X = Src offset (with 2 byte len header)
STX LZ4_HeaderAddr+1 ; and the address of the offset
STA LZ4_Literal_3+1 ; Uncompress a LZ4 Packed Data buffer (64 KB max)
SEP #$20 ; A = Bank Src,Bank Dst
STA LZ4_Match_5+1 ; X = SRC Byte offset
@digarok
digarok / dl_clear.s
Last active October 4, 2018 14:20
Code to clear an Apple II Double-Lo Resolution Screen in 6502 Assembly
** A = lo-res color byte
DL_Clear sta TXTPAGE1
ldx #40
:loop dex
sta Lo01,x
sta Lo02,x
sta Lo03,x
sta Lo04,x
sta Lo05,x
sta Lo06,x
@digarok
digarok / rpi_gsplus_build.sh
Created August 24, 2018 21:02
Build GSplus with hardware acceleration on Jessie/Retropie from scratch
git clone https://github.com/RetroPie/RetroPie-Setup
cd RetroPie-Setup
sudo ./retropie_packages.sh sdl2
sudo apt-get update -y
sudo apt-get install -y libpcap0.8-dev libsdl2-image-dev
git clone https://github.com/digarok/gsplus.git
cd gsplus/src
ln -s vars_rpilinux_sdl2 vars