Skip to content

Instantly share code, notes, and snippets.

View bbayles's full-sized avatar

Bo Bayles bbayles

View GitHub Profile
@bbayles
bbayles / multiprocessing_freeze_support.py
Created March 14, 2019 15:08
Multiprocessing Freeze Support Test
import sys
print('Arguments were', repr(sys.argv))
from argparse import ArgumentParser
import multiprocessing
from random import randrange
from time import sleep
def talk(x):
sleep(x)
@bbayles
bbayles / sign_modules.py
Last active January 22, 2019 15:47
Sign kernel modules for secure boot
#!/usr/bin/env python
from __future__ import print_function
import io
import glob
import os
import subprocess
os.chdir(os.path.dirname(__file__))
priv_file = 'MOK.priv'
@bbayles
bbayles / skiptest.py
Created May 15, 2018 02:07
Demonstrate test skipping
import unittest
class SampleTest(unittest.TestCase):
def test_skipTest(self):
self.skipTest('lowecase')
def test_SkipTest(self):
raise unittest.SkipTest('UpperCase')
@bbayles
bbayles / bpo_21417.py
Last active January 22, 2019 15:48
Test for bpo21417 patch
# Tests for bpo-21417
import itertools
import os.path
import tempfile
import zipfile
# Compress a large-ish file, like the dictionary
file_path = '/usr/share/dict/american-english'
# Read its contents for later comparison
@bbayles
bbayles / tempo_change.py
Last active January 22, 2019 15:48
Speed up audio files with SoX
from glob import iglob
from os import chdir
from os.path import join
from subprocess import check_call
infile_dir = "/path/somewhere"
chdir(infile_dir)
for file_path in sorted(iglob('*.mp3')):
print(file_path)