Skip to content

Instantly share code, notes, and snippets.

View bhargavrpatel's full-sized avatar
💭
I may be slow to respond.

Bhargav Patel bhargavrpatel

💭
I may be slow to respond.
  • Instacart
  • Toronto, Canada
View GitHub Profile
@bhargavrpatel
bhargavrpatel / AFTER
Last active August 29, 2015 13:57
Simplifying C# properties
namespace LanguageFeatures.Models {
public class Product {
public int ProductID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public string Category { set; get; }
}
}
@bhargavrpatel
bhargavrpatel / Using Initializers in C#
Last active August 29, 2015 13:57
Something that would go inside your Models
/* CASE I: OBJECTS */
// BEFORE
public ViewResult CreateProduct() {
// create a new Product object
Product myProduct = new Product();
// set the property values
myProduct.ProductID = 100;
myProduct.Name = "Kayak";
myProduct.Description = "A boat for one person";
/*
!.gitignore
#!.gitattributes this is optional
# Ignore game folder, and all default dota_addons folders
!game
/game/*
!/game/dota_addons
/game/dota_addons/*
/*
!.gitignore
!.gitattributes
# Ignore game folder, and all default dota_addons folders
!game
/game/*
!/game/dota_addons
/game/dota_addons/*
function Activate()
GameRules.AddonTemplate = TreeTagGameMode()
GameRules.AddonTemplate:InitGameMode()
end
@bhargavrpatel
bhargavrpatel / Instructions.bash
Created October 26, 2014 22:20
How to setup wiringpi2 for Python3
# Install python3-dev and python3-setuptools
sudo apt-get install build-essential python3-dev python3-setuptools \
python3-numpy python3-scipy \
libatlas-dev libatlas3gf-base
# Install wiringpi itself
git clone git://git.drogon.net/wiringPi && cd wiringPi && sudo ./build && cd ..
# Install wiringpi2 for Python3

Used Brew to install opencv3

  1. Open iPython and import opencv2.
import cv2
  1. Create new virtualenv
@bhargavrpatel
bhargavrpatel / supervisord.sh
Created February 20, 2017 18:46 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@bhargavrpatel
bhargavrpatel / flask-tenant-subdomain.py
Created December 16, 2017 03:07 — forked from souzaux/flask-tenant-subdomain.py
Create a Flask application using the app factory pattern.
#app.py
def create_app(settings_override=None):
"""
Create a Flask application using the app factory pattern.
:param settings_override: Override settings
:return: Flask app
"""
app = Flask(__name__, instance_relative_config=True, static_folder=None)
#flask-tenant-schema:
https://www.destroyallsoftware.com/screencasts/catalog/first-attempt-at-database-library/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/three-router-tweaks/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/variables-in-routes/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/routing-simple-requests/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/malloc-from-scratch/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/http-server-from-scratch/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/shell-from-scratch/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/text-editor-from-scratch/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/data-compressor-from-scratch/download?resolution=1080p
https://www.destroyallsoftware.com/screencasts/catalog/a-compiler-from-scratch/