Skip to content

Instantly share code, notes, and snippets.

View varunagrawal's full-sized avatar
🎯
Focusing

Varun Agrawal varunagrawal

🎯
Focusing
View GitHub Profile

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@varunagrawal
varunagrawal / mexopts.sh
Last active November 1, 2015 16:39 — forked from yassersouri/mexopts.sh
`~/.matlab/R2015a/mexopts.sh` for Mac OS X 10.10 with homebrew.
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
@varunagrawal
varunagrawal / virtualenv-auto-activate.sh
Created November 5, 2016 03:41 — forked from robbles/virtualenv-auto-activate.sh
virtualenv-auto-activate with support for zsh and virtualenvwrapper
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@varunagrawal
varunagrawal / mnist.py
Created February 16, 2017 21:37 — forked from akesling/mnist.py
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
"""
def read(dataset = "training", path = "."):
@varunagrawal
varunagrawal / center_geo.py
Created February 19, 2017 02:44 — forked from amites/center_geo.py
Center Geolocations
from math import cos, sin, atan2, sqrt
def center_geolocation(geolocations):
"""
Provide a relatively accurate center lat, lon returned as a list pair, given
a list of list pairs.
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),)
out: (center_lat, center_lon)
"""
x = 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
@varunagrawal
varunagrawal / script_dir.sh
Created March 28, 2020 20:38 — forked from elentok/script_dir.sh
Current script directory (works in bash and zsh)
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
SCRIPT_DIR=`cd $SCRIPT_DIR && pwd`
@varunagrawal
varunagrawal / git_subtree_basics.md
Created August 27, 2020 17:15 — forked from SKempin/Git Subtree basics.md
Git Subtree Basics

Git Subtree Basics

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

Background

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
varunagrawal / jupyter_ngrok.md
Last active March 25, 2024 17:07 — forked from artificialsoph/jupyter_ngrok.md
Quickest way to get Jupyter notebook running on a remote server.

Log into your server with ssh or TeamViewer.

If it's a new server, install Python (using pyenv) and jupyter.

pip install jupyter -y

To use jupyter, we need to modify a few settings and create a password: