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 pathlib | |
import cv2 as cv | |
import fire | |
import imagehash | |
from PIL import Image | |
def dedup(video_uri: str, output_dir: str, min_hash_difference_between_key_frames: float=10): | |
cap = cv.VideoCapture(video_uri) |
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
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | |
# https://wiki.archlinux.org/index.php/CPU_frequency_scaling |
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
"""Example for passing Tensorflow configuration variables from python script. | |
Many tensorflow scripts variable are defined with absl, which parses inputs from | |
command line by default. Here is a way to set the flags in a python script. | |
""" | |
from absl import flags | |
FLAGS = flags.FLAGS | |
flags.DEFINE_integer('my_version', 0, 'Version number.') |
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
python -c 'import sys; import tensorflow as tf; ex=next(tf.python_io.tf_record_iterator(sys.argv[1])); print(tf.train.Example.FromString(ex))' <path-to-tfrecord> |
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
# in Docker >v17, DOCKER-USER chain is introduced. It is a | |
# iptable chain in FILTER table, called before DOCKER chain. | |
# By default, it accepts all connections. | |
# delete default return rule | |
sudo iptables -D DOCKER-USER -j RETURN | |
# allow default container and private subnet | |
sudo iptables -C DOCKER-USER -s 172.16.0.0/12 -j ACCEPT || sudo iptables -I DOCKER-USER 1 -s 172.16.0.0/12 -j ACCEPT | |
sudo iptables -C DOCKER-USER -s 192.168.0.0/16 -j ACCEPT || sudo iptables -I DOCKER-USER 1 -s 192.168.0.0/16 -j ACCEPT | |
sudo iptables -C DOCKER-USER -s 10.0.0.0/8 -j ACCEPT || sudo iptables -I DOCKER-USER 1 -s 10.0.0.0/8 -j ACCEPT | |
# allow CMU ips |
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 tarfile | |
import time | |
import numpy as np | |
import six.moves.urllib as urllib | |
import tensorflow as tf | |
tf.logging.set_verbosity(tf.logging.INFO) |
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
virt-customize -a /var/lib/libvirt/images/debian9-vm1.qcow2 --root-password password:NewRootUserPasswordHere --uninstall cloud-init |
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
# Use qemu directly with kvm | |
# sudo qemu-system-i386 -machine accel=kvm -m 2048 mn-trusty64server-170321-14-17-08/mininet-vm-x86_64.vmdk -net nic,model=virtio -net user,net=192.168.101.0/24,hostfwd=tcp::8022-:22 | |
# sample libvirt xml with port forwarding enabled | |
# copy the following | |
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> | |
<name>mininet</name> | |
<uuid>cd4dbb45-1628-4310-9a1a-f8bc62ca91c0</uuid> | |
<memory unit='KiB'>4194304</memory> | |
<currentMemory unit='KiB'>4194304</currentMemory> | |
<vcpu placement='static'>2</vcpu> |
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
// Place your key bindings in this file to overwrite the defaults | |
// File path on Ubuntu is $HOME/.config/Code/User/keybindings.json | |
[ | |
// ctrl+shift to navigate among UI elements | |
{ | |
"key": "ctrl+shift+up", | |
"command": "-workbench.action.terminal.scrollUp", | |
"when": "terminalFocus" | |
}, |
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 __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import fire | |
LICENSE_CONTENT = {} | |
LICENSE_CONTENT['apache'] = """# Copyright (C) 2018 Carnegie Mellon University. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); |
NewerOlder