This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import hashlib | |
import fnmatch | |
from pathlib import Path | |
from collections import namedtuple | |
def calculate_sha1(path, chunksize=8192): | |
"""Calculate sha1 hexdigest of file | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from formatting import format_field | |
examples = [ | |
('Simple Hex BCD', 0x12Ab, '04X', '{0-4}'), | |
('With Prefix', 0x12Ab, '04X', 'Version: {0-4}'), | |
('Constant String', 0x12Ab, '04X', 'Some note about this'), | |
('Add separators', 0x12Ab, '04X', '{0-2}.{2-4}'), | |
('Swap Words', 0x12Ab, '04X', '{2-4}.{0-2}'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
# Type to struct type | |
SECTION_SHORT_NAME = "8s" | |
DWORD = "I" | |
WORD = "H" | |
BYTE = "B" | |
# Image directory indices | |
IMAGE_DIRECTORY_ENTRY_EXPORT = 0 # Export Directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fast_git_ps1() | |
{ | |
local gitdir git_ps1 | |
# Find git directory | |
local dir="$PWD" | |
while [ -n "$dir" ]; do | |
if [ -e "$dir/.git" ]; then | |
if [ ! -d "$dir/.git" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import classNames from "classnames"; | |
const getRoots = (data) => { | |
return Object.values(data).filter(node => node.isRoot === true) | |
} | |
const getChildNodes = (node, data) => { | |
if (!node.children) return []; | |
return node.children.map(path => data[path]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_RETRIES = 3 | |
const retryExpired = (context, event) => context.retries >= MAX_RETRIES | |
const passthroughMachine = Machine({ | |
id: 'passthrough', | |
initial: 'send_request', | |
context: { | |
retries: 0 | |
}, | |
states: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_RETRIES = 3 | |
const retryExpired = (context, event) => context.retries >= MAX_RETRIES | |
const passthroughMachine = Machine({ | |
id: 'passthrough', | |
initial: 'send_request', | |
context: { | |
retries: 0 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, getopt, time, re, random, os, socket | |
int_len = len(str(0xFFFFFFFFFFFFFFFF)) | |
def run_client(host, port): | |
count = 0 | |
order = 0 | |
dropped = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sampleSpecCSV = '''field name, description, units, range | |
Item1, The first item, feet, 100..200 | |
Item2, The second item, meters, 1000.000..2000.000 | |
Item3, Enumeration field, enum, MANUAL:AUTOMATIC | |
Item4, Some string, string(10), | |
''' | |
def fieldMappingCSV = '''field name, path, units, enum mapping | |
Item1, field1, feet, | |
Item2, nested1.field1, feet, |
NewerOlder