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 sys | |
import subprocess | |
import timeout_decorator | |
import random | |
import logging | |
if sys.version_info[0] < 3: | |
import pipes as shlex | |
else: |
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
''' | |
Demonstration of using `splice` with non-blocking IO | |
Lots of code is similar to 'splice.py', take a look at that module for more | |
documentation. | |
''' | |
#https://blogs.gnome.org/markmc/2013/06/04/async-io-and-python/ | |
import os | |
import os.path | |
import errno | |
import fcntl |
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 time | |
import threading | |
class BaseThread(threading.Thread): | |
def __init__(self, callback=None, callback_args=None, *args, **kwargs): | |
target = kwargs.pop('target') | |
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs) | |
self.callback = callback | |
self.method = target |
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
# -*- coding: utf-8 -*- | |
import unittest | |
import re | |
import datetime | |
from dateutil.relativedelta import relativedelta | |
#Standard datetime_string is string have all written by English, no GMT+xx, no [ago, today, yesterday] tag | |
def convert_to_standard_datetime_string(datetime_string): | |
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
2013-10-05 10:19:59 mikeboers@maxwell: ~/Documents/Python/PyAV | |
$ time python video_frames_via_pipe.py | |
real 0m0.564s | |
user 0m0.729s | |
sys 0m0.241s | |
2013-10-05 10:20:01 mikeboers@maxwell: ~/Documents/Python/PyAV | |
$ time python video_frames_via_pyav.py |
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
#!/bin/sh | |
# Preview and save webcam video on NVIDIA Jetson TK1 | |
# Grab audio and video (in h264 format) from Logitech c920 @ 1920x1080 | |
# Preview @ 1280x720 on screen | |
# Store video to file named gEncode1080p.mp4 | |
# Logitech c920 is video1 on this machine | |
VELEM="v4l2src device=/dev/video1 do-timestamp=true" | |
# Video capability from the camera - get h264 1920x1080 | |
VCAPS="video/x-h264, width=1920, height=1080, framerate=30/1" |
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
gst-launch-1.0 v4l2src ! "video/x-raw,width=640,height=480,framerate=15/1" ! \ | |
x264enc bitrate=1000 ! video/x-h264,profile=high ! h264parse ! queue ! \ | |
flvmux name=mux pulsesrc ! audioresample ! audio/x-raw,rate=48000 ! \ | |
queue ! voaacenc bitrate=32000 ! queue ! mux. mux. ! rtmpsink location="rtmp://127.0.0.1/mytv/mystream live=1" |
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 numpy as np | |
import tensorflow as tf | |
import tflearn | |
import matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
import tensorlayer as tl | |
import math | |
tf.reset_default_graph() | |
# TF-Slim is a lightweight library for defining, training and evaluating complex models in TensorFlow. |
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
''' | |
Author: komuw/pycrypto_AES.py | |
Security issues: | |
+ https://stackoverflow.com/questions/2641720/for-aes-cbc-encryption-whats-the-importance-of-the-iv | |
+ https://defuse.ca/cbcmodeiv.htm | |
+ https://passingcuriosity.com/2009/aes-encryption-in-python-with-m2crypto/ | |
''' | |
from Crypto.Cipher import AES |
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 tempfile | |
import torch | |
import torch.distributed as dist | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.multiprocessing as mp | |
import numpy as np | |
import random | |
from torch.nn.parallel import DistributedDataParallel as DDP |
OlderNewer