Skip to content

Instantly share code, notes, and snippets.

@Grezzo
Grezzo / 7Seg.html
Last active March 24, 2022 16:37
Quad 7 Segment Display in HTML/JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Quad 7 Segment Display in HTML/JavaScript</title>
<style type="text/css">
div.anode {
border: solid 2px red;
background: red;
color: white;
@Grezzo
Grezzo / Pocket RC4 Decode.py
Last active August 29, 2015 14:22
Pocket RC4 Decode for challenge 1 of MWR's HackFu 2015 Challenge
#Orders document for challenge 1 of MWR's HackFu 2015 mentions "Pocket RC4"
#Decrypt Pocket RC4 using algorythm from http://aarontoponce.org/wiki/card-ciphers/pocket-rc4
#Twitter account for clues is mentioned in earlier document
#Suit order from a tweet clue by MWRLabs (https://twitter.com/mwrlabs)
#"He Shall Conquer Dragons" (https://twitter.com/mwrlabs/status/579991389410357248)
def letter_to_number(letter):
return ord(letter.upper()) - 64 #64 is the number chars before "A"
@Grezzo
Grezzo / fixfcpxml.py
Last active March 29, 2017 13:05
Opens an fcpxml (from Apple FCP X) and modifies the asset elements to contain enough audio information to be used properly by any audio elements
#! /usr/bin/env python
import logging
def get_assets_dict(asset_elements):
#Create dictionary
asset_elements_dict = {}
#Add each asset to dictionary with id as key
for asset_element in asset_elements:
asset_id = asset_element.get("id")
/*
* Monitor-Auto-Rotate v1
*
* Sketch that will change display orientation by using usb keyboard emultaion to
* press Ctrl+Alt+Up-Arrow or Ctrl+Alt+Right-Arrow (which are the default hotkeys
* to rotate the display on windows systems with Intel graphics drivers) when it
* senses (using a reed switch and a magnet) that the monitor has been physically
* rotated.
*
* Requires updating the Arduino's atmega8u2 USB firmware so that it can emulate
/*
* Sketch for DigiSpark that will change display orientation by using usb
* keyboard emulation to press Ctrl+Alt+Up-Arrow or Ctrl+Alt+Left-Arrow
* (which are the default hotkeys to rotate the display on windows systems
* with Intel graphics drivers) when it senses (using a tilt switch) that
* the monitor has been physically rotated.
*
* It also illuminates the onboard LED when it thinks the monitor should
* be in portrait mode
*
@Grezzo
Grezzo / GC5Z9V4_Solution.html
Created May 10, 2016 13:11
Draws the solution to GC5Z9V4 in an HTML canvas using JavaScript
<!DOCTYPE html>
<html>
<body>
<canvas id="canv" width="200" height="130" style="border:solid; border-width:1px;"></canvas>
</body>
<script>
var instructions = "00006333 22533133 13323323 36223331 53333623 15362231 35332332 33133133 63133225 33133133 13323323 36233331 31536223
13153333 62353323 32336223 32533233 22633331 53333622 33132253 32336113 33332333 00000000 00000000 33333333 31536231 53333613 31533336 23332253
@Grezzo
Grezzo / enable_all_angles.py
Last active October 10, 2016 12:34
Opens an fcpxml (from Apple FCP X) and modifies the multicam clips to add all audio angles. It doesn't really work very well, and I've run out of time/inclination to get it working properly
#! /usr/bin/env python
#Todo:
#Update link to latest version
#check that video only angles are changed to all
#check that video only is "vidoe" and audio only is "audio" and both is "all
#check that angles with no audio are not added
import logging
#! /usr/bin/env python
import logging
def main():
import argparse, os, codecs, sys
from xml.dom.minidom import parse
#Set up argument parser
parser = argparse.ArgumentParser(description="Remove elements from an fcpxml",
epilog="Latest version available at https://gist.github.com/Grezzo/92cf94c8e1e1f1a58d3e2c1a4098fcaf")
@Grezzo
Grezzo / fcpxml_transcoded_media.py
Last active August 20, 2017 19:57
Changes paths in an fcpxml to point to transcoded media (proxy and high quality media) if it can be found.
#! /usr/bin/env python
import os
import urllib
import re
import logging
import argparse
import sys
from urlparse import urlparse, urljoin
import xml.etree.ElementTree as ET
@Grezzo
Grezzo / Filter DT Grid.py
Created April 13, 2017 15:29
Useful for filling D/T Grid. Takes a finds.gpx, and a caches.gpx and spits out a caches.gpx containing only caches needed to get D/T grid
#! /usr/bin/env python3.4
import xml.etree.cElementTree as ET
namespaces = {
'xmlns': 'http://www.topografix.com/GPX/1/0',
'groundspeak': 'http://www.groundspeak.com/cache/1/0/1'
}
def d_t_grid(gpx):