Skip to content

Instantly share code, notes, and snippets.

View iaverypadberg's full-sized avatar

Isaac Padberg iaverypadberg

View GitHub Profile
@iaverypadberg
iaverypadberg / check_labels.py
Created April 21, 2022 20:23
Check the integrity of labels after running the bash.sh script I wrote and piping it to a text file.
from re import T
labels = ["frodo","sam","legolas","gimli","karim benzema"]
# Open a text file to write the bad labels to
with open("bad_labels.txt","w") as bad:
# Open the text file with all of the data in it
with open("test2_xml/test.txt") as file:
@iaverypadberg
iaverypadberg / bash.sh
Last active April 26, 2022 14:43
Find a specific tags in an xml file with grep using regular exressions
# You can substitute out the tags for andy tags you like.
# The ".*" in the center of each tag specifies that any characters with any length can exist inside the tag
cat *.xml | grep -o -e "<name>.*<\/name>\|<filename>.*<\/filename>"
@iaverypadberg
iaverypadberg / format_xml.py
Created April 21, 2022 18:38
A python script for formatting lots of xml files in a directory.
import glob
import subprocess
# Replace this file directory with the location of the xml files
files = glob.glob('/home/isaac/Desktop/work_area/test2_xml/*.xml')
for xml_file in files:
bashCmd = ["xmllint","-format", "-o", "{}".format(xml_file), "{}".format(xml_file)]
process = subprocess.Popen(bashCmd, stdout=subprocess.PIPE)
/*
A function to change an ImageProxy to a bitmap
@param the image input
@return can be null or a bitmap
*/
fun preProcessImg(image : ImageProxy):Bitmap?{
val planes = image!!.planes
val yBuffer = planes[0].buffer
val uBuffer = planes[1].buffer
val vBuffer = planes[2].buffer
@iaverypadberg
iaverypadberg / Playground.hs
Created April 20, 2021 20:41
Plutus Playground Smart Contract
import qualified Data.Text as T
import Language.Plutus.Contract hiding (when)
import Language.PlutusTx.Prelude
import Playground.Contract
-- | A 'Contract' that logs a message.
hello :: Contract BlockchainActions T.Text ()
hello = logInfo @String "Hello, world"
endpoints :: Contract BlockchainActions T.Text ()