Skip to content

Instantly share code, notes, and snippets.

@fabianfreyer
fabianfreyer / dual-uart.py
Created December 25, 2023 22:33
Running multiple Glasgow Applets at once
import asyncio
import logging
import argparse
from glasgow.applet import GlasgowAppletError
from glasgow.applet.interface.uart import UARTApplet
from glasgow.target.hardware import GlasgowHardwareTarget
from glasgow.device.hardware import GlasgowHardwareDevice
from glasgow.access.direct import DirectMultiplexer, DirectDemultiplexer, DirectArguments
@fabianfreyer
fabianfreyer / acltest.ps1
Created November 6, 2019 21:52 — forked from wdormann/acltest.ps1
Check for paths that are writable by normal users, but are in the system-wide Windows path. Any such directory allows for privilege escalation.
If (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "This script will not function with administrative privileges. Please run as a normal user."
Break
}
$outfile = "acltestfile"
set-variable -name paths -value (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path.Split(";")
Foreach ($path in $paths) {
# This prints a table of ACLs
# get-acl $path | %{ $_.Access } | ft -Wrap -AutoSize -property IdentityReference, AccessControlType, FileSystemRights
@fabianfreyer
fabianfreyer / acltest.ps1
Created November 6, 2019 21:52 — forked from wdormann/acltest.ps1
Check for paths that are writable by normal users, but are in the system-wide Windows path. Any such directory allows for privilege escalation.
If (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "This script will not function with administrative privileges. Please run as a normal user."
Break
}
$outfile = "acltestfile"
set-variable -name paths -value (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path.Split(";")
Foreach ($path in $paths) {
# This prints a table of ACLs
# get-acl $path | %{ $_.Access } | ft -Wrap -AutoSize -property IdentityReference, AccessControlType, FileSystemRights
@fabianfreyer
fabianfreyer / field_storage.py
Last active November 15, 2015 23:10
Minimal example of field storage
class Schema(db.Model):
"""
Metadata describing a field type
"""
__tablename__ = 'field_schema'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(), unique=True)
category_id = db.Column(db.Integer, db.ForeignKey('category.id'))
category = db.relationship('Category',
lazy='joined',