Skip to content

Instantly share code, notes, and snippets.

View ahlusar1989's full-sized avatar
🏀
Let's Go!

Saran Ahluwalia ahlusar1989

🏀
Let's Go!
View GitHub Profile
@Dpananos
Dpananos / ex.R
Created April 13, 2024 16:09
Confounding example
library(tidyverse)
# Genuine confounding example. Sex confounds relationship between drug and death
set.seed(0)
n <- 1000000
is_male <- rbinom(n, 1, 0.5)
drug <- rbinom(n, 1, 0.6 + 0.3*is_male)
y <- rbinom(n, 1, 0.4 - 0.1*drug + 0.4*is_male)
d <- tibble(drug, is_male, y)
import numpy as np
from numpy.linalg import inv
x_observations = np.array([4000, 4260, 4550, 4860, 5110])
v_observations = np.array([280, 282, 285, 286, 290])
z = np.c_[x_observations, v_observations]
# Initial Conditions
a = 2 # Acceleration
@jkatz
jkatz / setup.sh
Last active September 9, 2023 03:00
Install PostgreSQL 10 & pgAdmin 4 with Docker
#!/bin/bash
mkdir postgres
cd postgres
docker volume create --driver local --name=pgvolume
docker volume create --driver local --name=pga4volume
docker network create --driver bridge pgnetwork
@hygull
hygull / MATLAB-TO-PYTHON-PACKAGE-THEN-GENERATE-MATLAB-CODE-TO-PYTHON-USING-OMPC.md
Last active February 10, 2019 15:29
MATLAB TO PYTHON PACKAGE, Python equivalent of MATLAB code using OMPC compiler

Creating Python package from MATLAB code using SDK compiler

This example shows how to create a Python package using a MATLAB function. You can then pass the generated package to the developer, who is responsible for integrating it into an application.

To compile a Python package from MATLAB code, follow the following steps one by one.

  1. In MATLAB, examine the MATLAB code that you want to deploy as a Python package. The example used here is makesqr.m, located in matlabroot\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp

    a. Open makesqr.m.

@smhatre59
smhatre59 / fileuploadroute.js
Last active October 23, 2018 23:43
file upload module
var fs = require("fs");
var path = require('path');
var writePath = '/home/saurabh/Documents/';
var cmd=require('node-cmd');
var async = require('async');
var jsonfile = require('jsonfile');
exports.fileupload = function(req,res){
// console.log("req",req.files);
var filesArray = req.files;
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@Yogendra0Sharma
Yogendra0Sharma / README.md
Created January 12, 2017 08:43 — forked from genomics-geek/README.md
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
  • ReactJS with Redux Pattern
  • Webpack module bundler manager
@alexisakers
alexisakers / Heroku-Vapor-Docker-Tutorial.md
Last active December 26, 2022 12:03
How to run Vapor with Docker in Heroku

How to run Vapor with Docker in Heroku

In this tutorial you'll learn how to run a Vapor server in a Docker container on Heroku.

Recently, Heroku added the ability to run Docker images on their Runtime. You can use this system instead of the traditional buildpack-based system for various reasons, mainly for having more control over the environment your server will run on.

Prerequisites

To complete this tutorial, you'll need:

@hex13
hex13 / render-promise-in-react.js
Created November 3, 2016 12:33
how to render promises in React
//License CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0/
class Deferred extends React.Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
}
componentDidMount() {