Skip to content

Instantly share code, notes, and snippets.

View benyblack's full-sized avatar

Behnam Yousefi benyblack

View GitHub Profile
@benyblack
benyblack / new_solution.sh
Last active November 20, 2021 18:26
A script for creating a new solution for dotnet
bold=$(tput bold)
normal=$(tput sgr0)
read -p "New solution name: " slnname
# Create directory
mkdir $slnname
cd $slnname
# Create solution and directories
import requests
import pandas as pd
import time
from datetime import datetime
from datetime import timedelta
import sys
from fhub import Session
import os
import finnhub
import Config
config :logger, level: :info
secret_key_base = System.fetch_env!("SECRET_BASE_KEY")
db_user = System.fetch_env!("DB_USERNAME")
db_pwd = System.fetch_env!("DB_PASSWORD")
db_name = System.fetch_env!("DB_NAME")
db_host = System.fetch_env!("DB_HOST")
FROM elixir:1.9.4-alpine as mixer
ENV LANG=C.UTF-8
ENV MIX_ENV=prod
# Install needed packages
RUN apk update && apk add nodejs npm
RUN mkdir /app
WORKDIR /app
FROM elixir:1.9.2
RUN mkdir /app
WORKDIR /app
ENV MIX_ENV=dev
# Install needed packages
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update && apt-get -y install curl inotify-tools nodejs
docker pull postgres
docker run -d --rm -p 5432:5432 --name postgres_hello_world_ci -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=hello_world_ci_dev postgres
echo no | mix phx.new hello_world_ci
cd hello_world_ci
mix deps.get
mix do compile
mix ecto.setup
cd assets && npm install && cd ..
mix phx.server
RED='\033[0;31m'
BLUE='\033[1;34m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
R="${BLUE}Running ${NC}"
D="${GREEN}Done! ${NC}"
clear
sleep 1
echo "${BLUE}Create a Postgres server by docker ${NC}"
echo "${R} docker pull postgres"
version: '3'
services:
database:
image: "postgres"
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: "hello_world_test"
FROM elixir:1.9.2 as mixer
ENV MIX_ENV=test
ENV PORT=4000
# COPY . /app
RUN mkdir /app
WORKDIR /app
RUN mix local.hex --force
@benyblack
benyblack / Dockerfile
Created October 17, 2019 08:09
Elixir Phoenix helloworld Dockerfile
###########################################################################
# Based on https://gist.github.com/teamon/27ed7e551d188930c9fa0b5e19bd76b7#
###########################################################################
FROM node:latest as build-node
# prepare build dir
RUN mkdir -p /app/assets
WORKDIR /app
# set build ENV