Skip to content

Instantly share code, notes, and snippets.

View andrewssobral's full-sized avatar
🔴
I may be very slow to respond.

Andrews Cordolino Sobral andrewssobral

🔴
I may be very slow to respond.
View GitHub Profile
@andrewssobral
andrewssobral / slack_dark_theme.js
Created October 8, 2018 13:34
slack_dark_theme
// First make sure the wrapper app is loaded
// https://github.com/widget-/slack-black-theme/issues/48
// alias slackdark='cat ~/slack_dark_theme.js >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js'
document.addEventListener("DOMContentLoaded", function() {
// Then get its webviews
let webviews = document.querySelectorAll(".TeamView webview");
// Fetch our CSS in parallel ahead of time
const cssPath = 'https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css';
@andrewssobral
andrewssobral / pytorch_jetson_install.sh
Created September 23, 2018 17:48 — forked from dusty-nv/pytorch_jetson_install.sh
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2
#!/bin/bash
#
# pyTorch install script for NVIDIA Jetson TX1/TX2,
# from a fresh flashing of JetPack 2.3.1 / JetPack 3.0 / JetPack 3.1
#
# for the full source, see jetson-reinforcement repo:
# https://github.com/dusty-nv/jetson-reinforcement/blob/master/CMakePreBuild.sh
#
# note: pyTorch documentation calls for use of Anaconda,
# however Anaconda isn't available for aarch64.
@andrewssobral
andrewssobral / jupyter_client.py
Created September 23, 2018 00:29
Jupyter Client (Python)
from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
from jupyter_client.manager import start_new_kernel
km, kc = start_new_kernel(kernel_name=NATIVE_KERNEL_NAME)
def run_cell(client, code, timeout=15):
print("\nrunning: ", code)
reply = client.execute_interactive(code, timeout=timeout)
status = reply['content']['status']
if status == 'ok':
@andrewssobral
andrewssobral / run_luigi.py
Created July 25, 2018 13:43 — forked from bonzanini/run_luigi.py
Example of Luigi task pipeline
# run with a custom --n
# python run_luigi.py SquaredNumbers --local-scheduler --n 20
import luigi
class PrintNumbers(luigi.Task):
n = luigi.IntParameter(default=10)
def requires(self):
return []
@andrewssobral
andrewssobral / cling_opencv_example.cpp
Created June 15, 2018 14:07
cling for opencv example
// cat cling_opencv_example.cpp | cling
.L /usr/lib/libopencv_highgui.so
#include <opencv/highgui.h>
#include <math.h>
#include <iostream>
using namespace std;
template <typename T> T deg2rad(T deg) { return deg*M_PI/180.0; }
@andrewssobral
andrewssobral / install-tensorflow.md
Created June 3, 2018 22:53 — forked from vellamike/install-tensorflow.md
Install tensorflow on Jetson TX2 (Jetpack 3.2)

Building TensorFlow from source for Jetson TX2 with Jetpack 3.2

Jetpack 3.2 includes Cuda 9 and CuDNN 7 so it is necessary to compile it from source.

Step 1 - Get Java

sudo apt-get install openjdk-8-jdk

Step 2 - Get some dependencies

@andrewssobral
andrewssobral / tegra-cam.py
Created June 2, 2018 23:10 — forked from jkjung-avt/tegra-cam.py
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <jkjung13@gmail.com>
@andrewssobral
andrewssobral / gstreamer_view.cpp
Created June 2, 2018 22:46 — forked from peter-moran/gstreamer_view.cpp
Bare-bones C++ script for viewing gstreamer video from the CSI port of the Nvidia Jetson TX2.
/*
Example code for displaying gstreamer video from the CSI port of the Nvidia Jetson in OpenCV.
Created by Peter Moran on 7/29/17.
https://gist.github.com/peter-moran/742998d893cd013edf6d0c86cc86ff7f
*/
#include <opencv2/opencv.hpp>
std::string get_tegra_pipeline(int width, int height, int fps) {
return "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)" + std::to_string(width) + ", height=(int)" +
@andrewssobral
andrewssobral / revert-a-commit.md
Created May 29, 2018 15:28 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: