Skip to content

Instantly share code, notes, and snippets.

Avatar

Vitaliy Shynkar vi2co

  • St. Louis, MO
View GitHub Profile
View unfoldArray.js
let arr = [1,[6,7],3,[1,2,3,4, [2,3,4]]];
function unfoldArray(arr) {
let arrNew = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i].length === undefined) {
arrNew.push(arr[i]);
} else {
arrNew = arrNew.concat(unfoldArray(arr[i]));
View vagrant_ubuntu
Vagrant.configure(2) do |config|
config.ssh.insert_key = false
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.define "dns" do |dns|
dns.vm.box = "ubuntu/trusty64"
dns.vm.network :private_network, ip: "10.12.10.5"
end
View Vagrant example config
## Default config for each machine
Vagrant.configure(2) do |config|
config.ssh.insert_key = false
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
## Per machine config
config.vm.define "haproxy1" do |haproxy1|
haproxy1.vm.hostname = "lb01.example.com"
View gist:9e21cf5e55372df87c3e6a945e851cdb
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "Usage: $0 <namespace>"
echo "For example: $0 dev"
exit 1
else
NAMESPACE=$1
fi
View gist:1b489816399640dc952e1397f00659e9
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"S3JarBucket": {
"Description": "The name of the S3 bucket that contains the source code of Lambda function.",
"Type": "String"
},
"Namespace": {
"Description": "The environment name (dev)",
"Type": "String",
View gist:b481ce90525c45299a0a4a44bb4d651d
</exec>
<echo message="Installing composer..." />
<exec dir="${dir}" executable="php" description="Installing composer." failonerror="true">
<arg value="composer.phar" />
<arg value="install" />
</exec>