Skip to content

Instantly share code, notes, and snippets.

View sebnyberg's full-sized avatar
🇸🇪

Sebastian Nyberg sebnyberg

🇸🇪
View GitHub Profile
@sebnyberg
sebnyberg / _vsvimrc
Created November 27, 2017 12:48
VSVIMRC
let mapleader = "\<Space>"
set timeoutlen=250
nnoremap <leader>w :w<cr>
inoremap jk <esc>
vnoremap jkl <esc>
nnoremap jk <esc>
nnoremap <leader>r :vsc Resharper.Resharper_Rename <cr>
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
export EDITOR="vim"
if [ -t 1 ]; then
exec zsh
fi
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:$HOME/.local/bin:/opt/anaconda2/bin:/opt/cuda/bin:$PATH
# Set npm config prefix (user-specific installations)
export npm_config_prefix=$HOME/.node_modules
# Add npm to path
export PATH=$PATH:$HOME/.node_modules/bin
export PATH=$PATH:$HOME/.yarn/bin
@sebnyberg
sebnyberg / RDS-Aurora-CloudFormation-Example.yaml
Created February 6, 2018 15:40 — forked from sjparkinson/RDS-Aurora-CloudFormation-Example.yaml
A basic CloudFormation template for an RDS Aurora cluster.
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
A basic CloudFormation template for an RDS Aurora cluster.
Parameters:
DatabaseUsername:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 1 to 16 alphanumeric characters.
@sebnyberg
sebnyberg / serverless.yml
Last active February 11, 2018 16:56
CloudFormation environment variables
# serverless.yml
# ...
provider:
name: aws
environment:
MY_GREETING: "Hello!"
UserData:
Fn::Base64:
Fn::Sub: |
#!/bin/bash
# install pip
OS=`cat /etc/os-release | grep '^NAME=' | tr -d \" | sed 's/\n//g' | sed 's/NAME=//g'`
if [ "$OS" == "Ubuntu" ]; then
apt-get -y update
Resources:
Type: AWS::EC2::Instance
Properties:
# ...
UserData:
Fn::Base64: |
#!/bin/bash
echo 'hello, world' > /var/log/user-data-log.txt
Resources:
Instance:
Type: AWS::EC2::Instance
Properties:
# ...
UserData:
Fn::Base64:
Fn::Sub: |
#!/bin/bash
Resources:
# ...
DescribeInstancesPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: 'Ec2-DescribeInstances'
PolicyDocument:
Statement:
- Effect: Allow
Action:
ubuntu@i:~$ aws ec2 describe-tags --region "$REGION" \
--query 'Tags[].[Key,Value]' \
--output text
Name my-instance-name
GREETING hello
TAG1 test
TAG2 test2
ubuntu@i:~$