Skip to content

Instantly share code, notes, and snippets.

View sachith-1's full-sized avatar
🎯
Focusing

Sachith sachith-1

🎯
Focusing
View GitHub Profile
@sachith-1
sachith-1 / Dockerfile
Last active April 28, 2022 07:22
Dockerfile for multi-stage build demo
# base
FROM node:17.9.0 AS base
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
@sachith-1
sachith-1 / builder.sh
Last active April 27, 2022 10:56
bash script for docker builder pattern demo
#!/bin/bash
echo building image node_project:build
docker build -t node_project:build -f Dockerfile.build .
# create a new container from the image and copy dist folder content to distapp folder
docker create --name copyContainer node_project:build
docker cp copyContainer:/usr/src/app/dist ./distapp
docker rm -f copyContainer
@sachith-1
sachith-1 / Dockerfile.prod
Created April 27, 2022 10:51
Dockerfile for docker builder pattern demo - production
FROM node:17.9.0-alpine3.15
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY distapp ./
@sachith-1
sachith-1 / Dockerfile.build
Last active April 27, 2022 10:50
Dockerfile for docker builder pattern demo - builder
FROM node:17.9.0
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
@sachith-1
sachith-1 / hv.bat
Created November 6, 2021 18:46
Simple script to enable hyper-v for windows 10 home
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hv.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hv.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause
void dataToArray(int* a, int n){
int i;
for(i = 0;i < n; ++i){
a[i]=i;
}
}
__global__ void getSum(int *n1, int *n2, int *sumData, int size){
int index = threadIdx.x + blockIdx.x * blockDim.x;
if( index<size ){
sumData[index] = n1[index] + n2[index];
}
}
int main() {
int n1, n2, sum;
int *dN1, *dN2, *dSum;
int size = sizeof(int);
// allocate device memory
cudaMalloc((void **)&dN1, size);
cudaMalloc((void **)&dN2, size);
int main(){
int n1, n2, sum;
int *dN1, *dN2, *dSum;
int size = sizeof(int);
// allocate device memory
cudaMalloc((void **)&dN1, size);
cudaMalloc((void **)&dN2, size);
cudaMalloc((void **)&dSum, size);
int main() {
int *n1, *n2, *sum;
int *dN1, *dN2, *dSum;
int size = sizeof(int);
// allocate device memory
cudaMalloc((void **)&dN1, size);
cudaMalloc((void **)&dN2, size);