Skip to content

Instantly share code, notes, and snippets.

View devigned's full-sized avatar

David Justice devigned

View GitHub Profile
group :development do
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-puma', require: false
end
@devigned
devigned / cap-deploy-config.sh
Last active February 15, 2017 15:53
Capistrano deployment configuration
# install the newly added gem dependencies
bundle
# inititialize capistrano configuration
# `Capfile` in the root directory of your Rails app
# `deploy.rb` file in the config directory
# `deploy` directory in the config directory
cap install
@devigned
devigned / configure-server-rails.sh
Last active February 15, 2017 23:20
Configure Rails server
# install Nginx
sudo apt-get update
sudo apt-get install curl git-core nginx nodejs -y
# don't install documentation with gems
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
# add RVM's key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@devigned
devigned / create-vm-azure-cli.sh
Last active February 15, 2017 18:28
Create Ubuntu VM with Azure CLI
az login
az group create -n level0 -l westus
az vm create -g level0 -n level0vm --admin-username deploy --image ubuntults
# Sample output
# {
# "fqdns": "",
# "id": "/subscriptions/00000000-0000-0000-0000-0000000000/resourceGroups/level0/providers/Microsoft.Compute/virtualMachines/level0vm",
# "location": "westus",
# "macAddress": "00-0D-3A-34-D6-EC",
# "powerState": "VM running",
@devigned
devigned / rails-create-level0.sh
Last active February 15, 2017 21:43
Level 0 create Rails Application
git clone [email protected]:YOUR_USER/level0.git
gem install bundler rails
rails new level0
cd level0
# add a simple hello world index page
printf "<html><head></head><h1>Hello World</h1></html>\n" > public/index.html
rails server
# you should now be able to open http://localhost:3000
@devigned
devigned / network-sample.cs
Last active July 8, 2016 15:17
quick sample of network related functionality to get some feedback
Write("Creating a public IP address for the load balancer");
var publicIpCreateParams = new PublicIPAddress {
Location = westus,
PublicIPAllocationMethod = IPAllocationMethod.Dynamic,
DnsSettings = new PublicIPAddressDnsSettings{ DomainNameLabel = "sample-dotnet-domain-name-label" }
};
var pubIp = networkClient.PublicIPAddresses.CreateOrUpdate(resourceGroupName, "sample-dotnet-pubip", publicIpCreateParams);
Write("Building the frontend IP configuration to expose the public IP");
var frontendIPConfig = new FrontendIPConfiguration{

Keybase proof

I hereby claim:

  • I am devigned on github.
  • I am devigned (https://keybase.io/devigned) on keybase.
  • I have a public key ASBoFS3R2NrAuuwcPKAnD3Hex0FKSwuXkIfvFg40zepTTAo

To claim this, I am signing this object:

@devigned
devigned / azps-1-0-webapps.ps1
Created November 17, 2015 21:48
WebApps piping in Azure PowerShell 1.0
# Login if you haven't already
Login-AzureRmAccount
# Create a new resource group
New-AzureRmResourceGroup -Location westus -Name webapptestrg
# Create a new WebApp
New-AzureRmWebApp -ResourceGroupName webapptestrg -Location westus -Name djtestwebapp
# List all the WebApps for all of your resource groups
@devigned
devigned / sp-w-cert-azps-1-0.ps1
Last active October 25, 2023 12:34
Create a service principal to auth with a certificate in Azure PowerShell 1.0
# Login to Azure PowerShell
Login-AzureRmAccount
# Create the self signed cert
$currentDate = Get-Date
$endDate = $currentDate.AddYears(1)
$notAfter = $endDate.AddYears(1)
$pwd = "P@ssW0rd1"
$thumb = (New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -DnsName com.foo.bar -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $notAfter).Thumbprint
$pwd = ConvertTo-SecureString -String $pwd -Force -AsPlainText
# To login to Azure Resource Manager
Login-AzureRmAccount
# You can also use a specific Tenant if you would like a faster login experience
# Login-AzureRmAccount -TenantId xxxx
# To view all subscriptions for your account
Get-AzureRmSubscription
# To select a default subscription for your current session