This file contains hidden or 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/python3 | |
| import sys, cv2 | |
| video_file = sys.argv[1] | |
| video = cv2.VideoCapture(video_file) | |
| assert video.isOpened() | |
| frame_cnt = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) | |
| def read_frame(pos): |
This file contains hidden or 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/bash | |
| WIFI_DEVICE=$(iw dev | grep Interface | head -n 1 | sed 's/.*Interface //') | |
| sudo dhclient -r $WIFI_DEVICE | |
| sudo dhclient $WIFI_DEVICE |
This file contains hidden or 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
| apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ | |
| libxcb-render-util0 libxcb-shape0 libxcb-xfixes0 libxcb-xinerama0 \ | |
| libxcb-xkb1 libxkbcommon-x11-0 libgl1-mesa-glx fontconfig \ | |
| libfontconfig libfontconfig1 libfontconfig1-dev | |
| python3 -m pip install pyyaml qtpy qtpy5 pyside2 imgviz termcolor requests |
This file contains hidden or 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
| # conceptions: static images, running containers | |
| docker image ls # list all images | |
| docker image rm IMAGE_NAME # remove image | |
| docker run -t -i -d --rm --env=DISPLAY=$DISPLAY --net=host IMAGE_NAME /bin/bash # run a image | |
| docker exec -it CONTAINER_NAME /bin/bash # enter a container | |
| docker kill CONTAINER_NAME # kill a running container | |
| docker rm CONTAINER_NAME # remove a container | |
| docker ps # list all containers |
This file contains hidden or 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 sys, io, os.path as path, functools as ft # basic packages | |
| import urllib.request as url_req, numpy as np, cv2 # extension packages | |
| import torch, torch.nn as nn, torchvision.ops as ops # pytorch packages | |
| data_path = '.' if len(sys.argv) < 2 else sys.argv[1] | |
| image_file_url = 'https://github.com/pjreddie/darknet/raw/master/data/dog.jpg' | |
| image_filename = path.join(data_path, 'dog.jpg') | |
| weight_file_url = 'https://pjreddie.com/media/files/yolov3.weights' | |
| weight_filename = path.join(data_path, 'yolov3.weights') |
This file contains hidden or 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
| #include <execinfo.h> | |
| void print_trace (void) { | |
| void *ppArrays[256]; | |
| int nTraceNum = backtrace(ppArrays, sizeof(ppArrays) / sizeof(ppArrays[0])); | |
| char **ppSymbols = backtrace_symbols(ppArrays, nTraceNum); | |
| if (ppSymbols != NULL) { | |
| printf("Obtained %d stack frames.\n", nTraceNum); | |
| for (int i = 0; i < nTraceNum; i++) { | |
| printf("%s\n", ppSymbols[i]); | |
| } |
This file contains hidden or 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/bash | |
| set -e | |
| sudo apt update -qq | |
| sudo apt install -yq software-properties-common | |
| sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | |
| sudo apt update -qq | |
| sudo apt install -yq gcc-7 g++-7 | |
| sudo update-alternatives \ | |
| --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \ | |
| --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ |
This file contains hidden or 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
| if [[ $# -lt 4 ]]; then | |
| echo "Usage: "$0" <SERVER_IP> <SERVER_PORT> <PROXY_PSWD> <LOCAL_PORT>" | |
| exit 0 | |
| fi | |
| sudo apt-get -y install --no-install-recommends git gettext build-essential \ | |
| autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev \ | |
| automake libmbedtls-dev libsodium-dev libssl-dev autoconf libtool pkg-config | |
| rm -rf shadowsocks-libev |
This file contains hidden or 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/bash | |
| set -e | |
| if [[ $# -lt 3 ]]; then | |
| echo "Usage: "$0" <PROXY_PORT> <PROXY_PSWD>" | |
| exit 0 | |
| fi | |
| apt update |
This file contains hidden or 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/bash | |
| set -e | |
| sudo apt install -y libpython3-dev python3-pip | |
| sudo pip3 install numpy | |
| sudo apt purge libboost* | |
| sudo apt autoremove --purge |