Skip to content

Instantly share code, notes, and snippets.

View Mohitsharma44's full-sized avatar

Mohit Mohitsharma44

View GitHub Profile
@Mohitsharma44
Mohitsharma44 / file_scraper.py
Created July 21, 2015 20:23
Grab the files from an http server based on the extension of the filenames
from __future__ import print_function
__author__ = 'Mohit Sharma'
import requests
from bs4 import BeautifulSoup as bs
import urllib2
import os
_URL = 'http://serv.cusp.nyu.edu/files/cadence/'
@Mohitsharma44
Mohitsharma44 / recreate_easyrsa_index
Created April 8, 2016 19:12
recreate index.txt used by easy_rsa (for crl-verify). Make sure you have all the pem files. Pass all the pem files as argument as /pem_directory/*.pem
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Usage: $0 *.pem"
exit 1
fi
for cert
do
export PUREGEV_ROOT=/opt/pleora/ebus_sdk/Ubuntu-14.04-x86_64
export GENICAM_ROOT=$PUREGEV_ROOT/lib/genicam
export GENICAM_ROOT_V2_4=$GENICAM_ROOT
@Mohitsharma44
Mohitsharma44 / docker-pyspark-install.md
Last active January 13, 2017 20:05
pyspark-on-mac

The best way to run pyspark on a machine in a virtualized environment is to use docker. Docker is a container technology that allows developers to 'package' their software and ship it so that it takes away the headache of things like setting up environment properly, configuring logging, setting proper options, breaking the machine etc.. basically removes the excuse It works on my machine I'll stop babbling about docker and containers. If you're interested to know more, head here: http://unix.stackexchange.com/questions/254956/what-is-the-difference-between-docker-lxd-and-lxc

Step1: Installing docker on Mac

@Mohitsharma44
Mohitsharma44 / gist:8d21bbf8efe3bf161b16353e09e99b82
Created February 1, 2017 15:28
Installing gnuradio, osmosdr and hackrf on mac using mac ports
# Unfortunately this only works with macports for now. I have installed homebrew and macports on my mac
# and use macports explicitly for gnuradio stuff and homebrew as my default package manager. So far
# my system is not broken. I'm considering it as a good sign :p
Steps:
- Install MacPorts (if you havent) following the instructions from here: https://guide.macports.org/#installing
- Install python using Homebrew: brew install python
@Mohitsharma44
Mohitsharma44 / config.ini
Created February 2, 2017 02:16
move issues from one repo to another
# Rename to `config.ini`, and keep it in the same folder as `gh-issues-import.py`
# For a full list of options, see <http://www.iqandreas.com/github-issues-import/configuration/>
[source]
server = github.com
repository = mohitsharma44/myrepo
username = mohitsharma44@gmail.com
password = <my_fancy_password>
[target]
@Mohitsharma44
Mohitsharma44 / panamax.rb
Created March 14, 2017 23:00
Installing panamax 0.6.5 using local rb file (official installer broken due to explicit calling for sha1)
require "formula"
class Panamax < Formula
homepage "http://www.panamax.io"
url "http://download.panamax.io/installer/panamax-0.6.5.tar.gz"
sha256 "b59f21e5a821a3886eab0e62f85fc89d8fedea6099b79d3447906dfc36d163d7"
def install
system "./configure", "--prefix=#{prefix}", "--var=#{var}/panamax"
system "make", "install"
resource("additional_files").stage { bin.install "panamaxcli-darwin" }
@Mohitsharma44
Mohitsharma44 / subfolder_to_git.md
Created April 19, 2017 21:54
Adding a particular subfolder (from another git repo) to another subfolder (of other git repo) preserving the history

This is definitely not the best method but this is something that worked for me

  • clone the Repo (from where you want the subdirectory)
git clone --no-hardlinks repo2
  • Select the folder you want to keep
cd repo2
git filter-branch --subdirectory-filter path/to/subfolder HEAD -- --all
@Mohitsharma44
Mohitsharma44 / sha256-checksum.py
Last active April 25, 2017 21:43
sha256 for a file
import hashlib
import sys
import urllib2
import optparse
def sha256_checksum(url, block_size=65536):
filename = urllib2.urlopen(url)
sha256 = hashlib.sha256()
for block in iter(lambda: filename.read(block_size), b''):
sha256.update(block)
@Mohitsharma44
Mohitsharma44 / autossh_cusp
Last active July 27, 2017 19:39
Aassuming you have already setup password-less (or key-based) login to gw and compute, use this to have an "always-up" tunnel to compute. Install autossh using homebrew (for mac) or apt-get (for debian / ubuntu)
autossh -M 0 -f -N -C -L 2222:compute:22 gw.cusp.nyu.edu -o "ServerAliveCountMax=3" -o "ServerAliveInterval=10" -o "ExitOnForwardFailure=yes"