Skip to content

Instantly share code, notes, and snippets.

View jetsonhacks's full-sized avatar

JetsonHacks jetsonhacks

View GitHub Profile
@jetsonhacks
jetsonhacks / CannyDetection.py
Last active June 24, 2020 15:52
Python OpenCV 3.3 NVIDIA Jetson TX example for built-in camera; L4T 28.1
#!/usr/bin/env python
# MIT License
# Copyright (c) 2017 Jetsonhacks
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@jetsonhacks
jetsonhacks / Dockerfile.nbody
Last active June 21, 2020 04:54
Dockerfile for building simple nbody demo on Jetson
# Copyright (c) 2020, JetsonHacks. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@jetsonhacks
jetsonhacks / Dockerfile.oceanfft
Last active June 21, 2020 04:16
Dockerfile to build image for oceanfft container
# Copyright (c) 2020, JetsonHacks. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@jetsonhacks
jetsonhacks / maxCPU.sh
Created November 19, 2014 00:28
Set CPU to full performance on NVIDIA Jetson TK1 Development Kit
#!/bin/sh
# Set CPU to full performance on NVIDIA Jetson TK1 Development Kit
if [ $(id -u) != 0 ]; then
echo "This script requires root permissions"
echo "$ sudo "$0""
exit
fi
# To obtain full performance on the CPU (eg: for performance measurements or benchmarking or when you don't care about power draw), you can disable CPU scaling and force the 4 main CPU cores to always run at max performance until reboot:
@jetsonhacks
jetsonhacks / installCUDA65.sh
Last active April 1, 2020 18:51
Fresh install CUDA 6.5 on NVIDIA Jetson TK1 Development Kit
#!/bin/sh
# Fresh install for CUDA 6.5 on Jetson TK1 for Linux for Tegra (L4T) 21.1
# CUDA 6.5 REQUIRES L4T 21.1 !!!
sudo apt-add-repository universe
sudo apt-get update
# This is for L4T r21.1 ; Update for your L4T i.e. r21.3
wget http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb
# Install the CUDA repo metadata that you downloaded
# This is for L4T 21.1 ; Update for your L4T i.e. 21.3
@jetsonhacks
jetsonhacks / gEncodeH264WithPreviews.sh
Last active September 8, 2019 17:30
Using Gstreamer, take a h264 stream from a Logitech c920, preview it on the display and save it to a file along with the webcam audio.
#!/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"
@jetsonhacks
jetsonhacks / installiTorch.sh
Last active August 31, 2019 04:42
Install iTorch and prerequisites
#!/bin/sh
# Install Python prerequisites on NVIDIA Jetson TK1 for iTorch
# This is for https://github.com/facebook/iTorch
# L4T 21.3, Torch 7 (http://torch.ch)
# Python 2.7 or greater must be installed before running this script
# Torch 7 should already be installed before running this script
# iPython is loaded using pip, as repository version is 1.x version, > 2.0 is needed
# Need to compile from source as repository version libzmq3-dev is not the correct revision
wget http://download.zeromq.org/zeromq-4.0.5.tar.gz
tar xzvf zeromq-4.0.5.tar.gz
@jetsonhacks
jetsonhacks / createSwapfile.sh
Created October 4, 2014 21:19
Create a Swapfile
#!/bin/bash
#NVIDIA Jetson TK1
#Create a swapfile for Ubuntu at the current directory location
fallocate -l 4G swapfile
#List out the file
ls -lh swapfile
# Change permissions so that only root can use it
chmod 600 swapfile
#List out the file
ls -lh swapfile
@jetsonhacks
jetsonhacks / gstreamerPreviewWebcam.sh
Created October 17, 2014 04:14
Use GStreamer to preview webcams
#!/bin/sh
# Show a webcam that delivers video 1920x1080 MJPG on screen
VELEM="v4l2src device=/dev/video0"
VCAPS="image/jpeg, width=1920, height=1080, framerate=30/1"
VSOURCE="$VELEM ! $VCAPS"
VIDEO_SINK="videoconvert ! videoscale ! xvimagesink sync=false"
VIDEO_DECODE="jpegparse ! jpegdec"
# echo is just for debugging purposes
echo gst-launch-1.0 -vvv \
@jetsonhacks
jetsonhacks / getJetsonTFBuild.sh
Last active December 18, 2018 15:10
Get the JasonAtNVIDIA JetsonTFBuild scripts without the wheel files
#!/bin/bash
cd $HOME
# Get TensorFlow build scripts from JasonAtNvidia JetsonTFBuild repository
git clone --no-checkout https://github.com/JasonAtNvidia/JetsonTFBuild.git
cd JetsonTFBuild
# Sparse checkout tells git not to checkout the wheels directory
# where all of the .whl files are kept
git config core.sparsecheckout true
# Do not checkout the wheels directory
echo '!wheels/*' >> .git/info/sparse-checkout