Skip to content

Instantly share code, notes, and snippets.

View docker-compose-db-mssql.yml
version: '3.1'
# reference:
# - docker mssql notes: https://docs.docker.com/storage/volumes/
# - setup mssql docker linux named volumes: https://dbafromthecold.com/2019/03/21/using-docker-named-volumes-to-persist-databases-in-sql-server/
# - run docker mssql: https://medium.com/@reverentgeek/sql-server-running-on-a-mac-3efafda48861
services:
mssql-db:
image: mcr.microsoft.com/mssql/server:latest
@vafrcor
vafrcor / Python-Multiply-Factor-Round.py
Created Dec 3, 2020
Rounding by Multiply Factor in python
View Python-Multiply-Factor-Round.py
def round_multiply_by_factor(factor: float = 0, input_value: float = 0 ) -> float:
fix = False
x= input_value
y= 1.0
while fix == False:
if x <= (y * factor):
x= y * factor
fix = True
y+=1
return x
@vafrcor
vafrcor / node-configstore-loader.js
Last active Apr 12, 2020
NodeJS Config Loader using configstore module
View node-configstore-loader.js
const dotenv = require('dotenv');
dotenv.config();
const fs = require('fs');
const approot = require('app-root-path');
const _ = require('lodash');
const ConfigStore = require('configstore');
const app_name = process.env.APP_NAME || 'app_config';
const config_path = process.env.APP_CONFIG_PATH || approot + '/config';
const readdir_mode = process.env.APP_CONFIG_READDIR_MODE || 'recursive';
@vafrcor
vafrcor / node-interactive-menu.js
Created Apr 11, 2020
NodeJS Interactive Menu Example
View node-interactive-menu.js
const moment = require('moment');
const _ = require('lodash');
const urlencode = require('urlencode');
const approot = require('app-root-path');
const readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@vafrcor
vafrcor / sequelize-migrator.js
Last active Dec 5, 2020
Node Sequelize Migrator Programmatically
View sequelize-migrator.js
const execSync = require('child_process').execSync;
const _ = require('lodash');
const asyncjs = require('async');
const sequelizeCliExec = (command) => {
let commands=[
'db:drop',
'db:create',
'db:migrate',
'db:migrate:undo:all',
View NodeJS - Rijndael-128-ECB-encryption.js
'use strict';
//# check required modules
var module_exists = require('module-exists');
var required_modules=['js-rijndael', 'base64-js', 'lodash'];
var valid_requirement=required_modules.length;
var not_exist_module=[];
required_modules.forEach(function(em){
if(module_exists(em) === false){
valid_requirement--;
View start.php
<?php
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.