Skip to content

Instantly share code, notes, and snippets.

@bluengreen
bluengreen / postgres_rails_os_x
Created May 18, 2018 02:17 — forked from migzsuelto/postgres_rails_os_x
PostgreSQL with Rails on OS X
# Setting up and using PostgreSQL with Rails on OS X
# Allows you to use PostgreSQL instead of sqlite3, and have the same database type as Heroku
# Install postgres using homebrew
brew install postgres
# Follow directions provided by postgres installation
# Instructions for this part can be retrieved again using "brew info postgres"
# This creates a default user according to your system name
# If you encounter an error similar to this, then check out these helpful links
#!/bin/bash
# settings the paths
mirthPath="/opt/mirthconnect/"
backupPath="/home/mirth/backups/"
scriptPath=`pwd`"/"
vDate=`date --date 'yesterday' +%Y-%m-%d`
# generating console command
echo exportcfg ${backupPath}mirth_backup-${vDate}.xml > ${scriptPath}backup_cmds

Prerequisites:

Software dependances

  • aws-vault
  • chamber
  • eb cli
  • aws cli
  • jq

Configure SSH Config

@bluengreen
bluengreen / Fragment
Created May 6, 2018 18:01
EB AWS Toolbox
# alias aws vault
alias awsv='aws-vault exec default -- '
@bluengreen
bluengreen / .ebextension-lets-encrypt.yaml
Created April 12, 2018 06:46 — forked from syamn/.ebextension-lets-encrypt.yaml
Let's Encrypt your Elastic Beanstalk single instance!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
@bluengreen
bluengreen / mirth_setup.md
Created April 7, 2018 05:39 — forked from jgautsch/mirth_setup.md
Setting up Mirth Connect for production

Mirth Server Setup

First create ec2 Ubuntu instance

Then install all the things needed for Mirth Connect (following this video: http://www.youtube.com/watch?v=omZyAO2naqs)

# Update Ubuntu
sudo aptitude update

# Safe upgrade of Ubuntu
sudo aptitude safe-upgrade
@bluengreen
bluengreen / mirth-csv-to-array.js
Created April 7, 2018 05:38
Mirth CSV file to collection of JavaScript literals
//the Mirth file reader has a CSV file (now in the msg object)
//be sure your channel's incoming data type is 'delimited text'
//let's pretend this csv contains customers
var customers = [];
var header = msg.row[0];
for(var i=1;i<msg['row'].length();i++)
{
var cust = {};
for (col in msg.row[i].children()) {
@bluengreen
bluengreen / mirth-csv-to-array.js
Created April 7, 2018 05:38
Mirth CSV file to collection of JavaScript literals
//the Mirth file reader has a CSV file (now in the msg object)
//be sure your channel's incoming data type is 'delimited text'
//let's pretend this csv contains customers
var customers = [];
var header = msg.row[0];
for(var i=1;i<msg['row'].length();i++)
{
var cust = {};
for (col in msg.row[i].children()) {
@bluengreen
bluengreen / mongiod_mysql_migrator.rb
Created November 1, 2017 20:51 — forked from tomriley/mongiod_mysql_migrator.rb
Migrate a Mongoid / MongoDB database to an ActiveRecord based SQL one. One method to convert the schema, another to migrate data. Copes with most basic data types. Some hacks to infer TEXT columns. Converts embeds_one relationships to AR aggregations. I wrote this for a one-time migration. It could be a good starting point for someone doing the …
# Migrate schema and data from Mongoid to MySQL ActiveRecord
class MongoidMysqlMigrator
def randomize_auto_increment_values(source_models, from=5500, to=10500)
source_models.each do |model|
value = rand(from-to)+from
sql = %(ALTER TABLE #{model.name.tableize} AUTO_INCREMENT=#{value})
puts sql
ActiveRecord::Base.connection.execute(sql)
end
export default createApi;
function createApi(options) {
const basePath = '/api/v1';
const endpoint = options.endpoint || 'https://vtx-mock-api-server.herokuapp.com';
const cors = !!options.cors;
const mode = cors ? 'cors' : 'basic';
const securityHandlers = options.securityHandlers || {};
const handleSecurity = (security, headers, params, operationId) => {
for (let i = 0, ilen = security.length; i < ilen; i++) {
let scheme = security[i];