Skip to content

Instantly share code, notes, and snippets.

Working from home

Varun Agrawal varunagrawal

Working from home
View GitHub Profile
varunagrawal / brew_ignition-math6_log.make
Created November 13, 2020 15:22
Ignition Math6 error log
View brew_ignition-math6_log.make
2020-11-13 10:20:20 -0500
/home/varun/.linuxbrew/Cellar/cmake/3.18.4/bin/cmake -S/tmp/ignition-math6-20201113-31262-1tcx3yt/ignition-math-6.6.0 -B/tmp/ignition-math6-20201113-31262-1tcx3yt/ignition-math-6.6.0 --check-build-system CMakeFiles/Makefile.cmake 0
/home/varun/.linuxbrew/Cellar/cmake/3.18.4/bin/cmake -E cmake_progress_start /tmp/ignition-math6-20201113-31262-1tcx3yt/ignition-math-6.6.0/CMakeFiles /tmp/ignition-math6-20201113-31262-1tcx3yt/ignition-math-6.6.0//CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/ignition-math6-20201113-31262-1tcx3yt/ignition-math-6.6.0'
/usr/bin/make -f CMakeFiles/doc.dir/build.make CMakeFiles/doc.dir/depend
varunagrawal /
Created August 27, 2020 17:15 — forked from SKempin/Git Subtree
Git Subtree Basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.


When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

varunagrawal /
Created March 28, 2020 20:38 — forked from elentok/
Current script directory (works in bash and zsh)
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
import gc
import numpy as np
import sys
import time
import torch
from torch.autograd import Variable
import torchvision.models as models
import torch.backends.cudnn as cudnn
import numpy as np
def average_precision(recall, precision):
mrec = np.hstack((0, recall, 1))
mpre = np.hstack((0, precision, 0))
for i in range(mpre.size-2, -1, -1):
mpre[i] = max(mpre[i], mpre[i+1])
varunagrawal / Dockerfile
Last active June 18, 2020 12:05
Docker for ROS
View Dockerfile
FROM osrf/ros:indigo-desktop-full
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y aptitude
RUN printf 'n\nY\nY\n' | aptitude install ros-indigo-fetch-gazebo-demo
SHELL ["/bin/bash", "-c"]
varunagrawal /
Last active October 22, 2021 17:35
Compiling OpenCV 3+

Also works for OpenCV 4


NOTE: We need to use cmake with HTTPS support to download the files when cmake runs. Any version of CMake >= 3.9 should do.

wget --no-check-certificate
tar -zxvf cmake-3.9.0.tar.gz
cd cmake-3.9.0
varunagrawal /
Last active December 15, 2020 01:35
ArchLinux Installation Guide

Arch Install Guide


  • Partition a drive on Windows and delete it so that it's free space. Note the size since we'll need it later.
  • Boot into Arch
  • Run fdisk -l to see the partitions.

Disk Partitioning

varunagrawal /
Last active September 4, 2021 16:59
Script to sync Taskwarrior after each operation
#!/usr/bin/env python3
# This hooks script syncs task warrior to the configured task server.
# The on-exit event is triggered once, after all processing is complete.
# Make sure hooks are enabled and this hook script is executable.
# Run `task diag` for diagnostics on the hook.
import sys
import json
varunagrawal /
Last active March 22, 2017 19:06
Install OpenCV2
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils