Skip to content

Instantly share code, notes, and snippets.

@adriankeenan
adriankeenan / create_stack_dynamodb_tables.py
Created June 24, 2024 21:48
Creating DynamoDB tables locally from CDK stacks
from glob import glob
import os
import json
import boto3
dynamo = boto3.resource('dynamodb', endpoint_url='http://localhost:{port}'.format(port=os.environ['DYNAMODB_PORT']))
dynamodb_table_resource_types = ['AWS::DynamoDB::GlobalTable', 'AWS::DynamoDB::Table']
dynamodb_table_create_keys = ['AttributeDefinitions', 'TableName', 'KeySchema', 'LocalSecondaryIndexes', 'GlobalSecondaryIndexes', 'BillingMode', 'ProvisionedThroughput', 'StreamSpecification', 'SSESpecification', 'Tags', 'TableClass', 'DeletionProtectionEnabled', 'ResourcePolicy']
@adriankeenan
adriankeenan / dvd.md
Created March 5, 2024 00:29
Linux DVD to MKV

A script I've been using to rip and remux DVDs to MKVs.

What this does:

  • Create an output folder named after the DVD title and current timestamp (allowing sorting and multiple runs per DVD, if needed)
  • makemkv is used to dump each title in to a separate MKV
  • Eject the disc on completion
@adriankeenan
adriankeenan / psp_video.md
Last active March 3, 2024 00:24
PSP Video Encoding

This is the ffmpeg command I've used to encode movies for movies for the Sony PSP. Different parts are shamelessly copied from other posts online.

The main benefit is that the resolution is set correctly, eg a non-16:9 source is scaled to fit within 480x272.

ffmpeg -i input.mkv -vcodec libx264 -b:v 500k -vf scale=w=480:h=272:force_original_aspect_ratio=decrease -profile:v main -level:v 2.1 -x264-params ref=3:bframes=1 -acodec aac -b:a 128k -ac 2 out.mp4

If the framrate is higher than 30, I expect you'll need to reduce it (eg with -r 30) for compatibility.

@adriankeenan
adriankeenan / thinkpad_p1_gen4_usbcpd_charging.md
Last active May 9, 2024 08:05
ThinkPad P1 Gen 4 USB-C PD Charging Testing

The ThinkPad P1 has no official requirements for USB-C chargers. This is the result of testing a few different USB-C chargers on my Gen 4 P1.

Notes:

  • Machine BIOS is N40ET44W 1.26.
  • This configuration (i7 11850H, RTX A3000) shipped with a 230W AC charger.
  • Result wattage read from Lenovo Vantage on Windows 11 Pro.
  • Windows does not acknowledge unsupported chargers at all (eg does not show any error messages). A KDE desktop does show a message that the wattage is too low for unsupported chargers.
  • Tested with a 100W C-C cable or 100W TB4 cable.

| Charger | Charger Wattage | Result |

@adriankeenan
adriankeenan / autoexec.cfg
Last active May 30, 2017 00:53
csgo config
safezonex 0.85
cl_radar_always_centered 0
cl_radar_scale 0.3
cl_crosshairalpha "200"
cl_crosshaircolor "5"
cl_crosshaircolor_b "50"
cl_crosshaircolor_r "50"
cl_crosshaircolor_g "250"
@adriankeenan
adriankeenan / UserAgentHelper.cs
Last active December 25, 2015 23:08
Helper async class for getting the user agent string on Windows Phone
class UserAgentHelper
{
private WebBrowser uaBrowser;
public event EventHandler<UserAgentEventArgs> GotUserAgent;
private const string html =
@"<html>
<head>
<script language=""javascript"" type=""text/javascript""></script>
</head>
</html>";
@adriankeenan
adriankeenan / pyFfmpegProgress.py
Last active December 12, 2020 22:49
Attain FFMPEG progress via regex
#store track duration in seconds
duration_flt = -1
#read each line of output from FFMPEG popen object
for line in output:
#no duration yet
if duration_flt == -1:
#get duration via regex match
dur_patern = re.compile("Duration: [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2}")
dur_matches = dur_patern.findall(line)