Skip to content

Instantly share code, notes, and snippets.

View Mohitsharma44's full-sized avatar

Mohit Sharma Mohitsharma44

View GitHub Profile
@Mohitsharma44
Mohitsharma44 / ansible-role-test.sh
Created February 5, 2018 04:28 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)

Keybase proof

I hereby claim:

  • I am mohitsharma44 on github.
  • I am mohitsharma44 (https://keybase.io/mohitsharma44) on keybase.
  • I have a public key ASCOPYChfoFRQcVwg_EytqqDcvTkpZWZwwbfjEo2zfupYQo

To claim this, I am signing this object:

@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"
@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 / 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 / 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 / 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 = [email protected]
password = <my_fancy_password>
[target]
@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 / 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

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