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 org.bouncycastle.cert.X509CertificateHolder; | |
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; | |
import org.bouncycastle.openssl.PEMParser; | |
import java.security.cert.X509Certificate; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.security.cert.CertificateException; | |
public class PEM2X509Certificate { |
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 com.igormaznitsa.jbbp.JBBPCustomFieldTypeProcessor; | |
import com.igormaznitsa.jbbp.compiler.JBBPNamedFieldInfo; | |
import com.igormaznitsa.jbbp.compiler.tokenizer.JBBPFieldTypeParameterContainer; | |
import com.igormaznitsa.jbbp.io.JBBPBitInputStream; | |
import com.igormaznitsa.jbbp.io.JBBPBitOrder; | |
import com.igormaznitsa.jbbp.io.JBBPByteOrder; | |
import com.igormaznitsa.jbbp.model.*; | |
import java.io.EOFException; | |
import java.io.IOException; |
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 xattr | |
import plistlib | |
x = xattr.xattr('mydownloaded.file') | |
where_from_plist = x['com.apple.metadata:kMDItemWhereFroms'] | |
where_from = plistlib.loads(where_from_plist) | |
# list object of URLs. Presumably right most is original URL and left most is the redirected location(s) | |
print(where_from) |
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
# 99.99 based on https://wiki.openmrs.org/display/docs/Check+Digit+Algorithm | |
def get_checkdigit(id_without_check): | |
# allowable characters within identifier | |
valid_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVYWXZ_" | |
# remove leading or trailing whitespace, convert to uppercase | |
id_without_checkdigit = id_without_check.strip().upper() |
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
{ | |
"Audio": {"AudioPackingMode": null, | |
"BitRate": "96", | |
"Channels": "2", | |
"Codec": "AAC", | |
"CodecOptions": {"BitDepth": null, | |
"BitOrder": null, | |
"Profile": "AAC-LC", | |
"Signed": null}, | |
"SampleRate": "48000"}, |
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 chardet.universaldetector import UniversalDetector # pip install chardet | |
import io | |
import os.path | |
def open(file, mode='r', buffering=-1, encoding=None, errors=None, | |
newline=None, closefd=True): | |
""" A wrapper for io.open(), which tries to detect the encoding of a file | |
using chardet before reading or writing | |
Supports all arguments of io.open(). "encoding" is only used if file does |
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
# HDS Load Testing Tool using Locust Load Testing Framework and HDS_Fragmenter library | |
# Simulates user access by fetching the bootstrap file to parse out fragment names. | |
# Bootstrap files are fetched 1/10 times. | |
# | |
# Usage: | |
# 1. Fetch dependencies given below | |
# 2. Edit "url_f4m_path" below to the stream-level manifest path/URI | |
# 3. Run: `locust -f hdslt.py -H http://my_origin_server` | |
# pip install locustio |
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 OpenSSL.crypto import * | |
import time | |
import datetime | |
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option("-f", "--file", dest="filename", | |
help="PKCS12/pfx file", metavar="FILE") | |
parser.add_option("-p", "--password", |
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
# An Display aspect ratio (DAR) detector for MPEG 2 Transport Streams with MP2 Video | |
import array | |
import logging | |
import sys | |
class NullHandler(logging.Handler): | |
def emit(self, record): | |
pass | |
NewerOlder