Lorem ipsum dolor
Sit amet, consectetur adipiscing elit. Vestibulum eget tortor sapien ac tempor
eleifend, ultrices mauris eget, commodo massa. Nam ullamcorper elementum arcu,
eu dictum libero tincidunt et. Orci varius natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Curabitur arcu leo, ullamcorper at
augue id, tincidunt eleifend mauris. Morbi vestibulum eu purus a consequat.
Nunc sit amet interdum dui. Sed sed aliquam leo
. Nam ac vehicula nunc. Curabitur
tempor tincidunt ex. Vestibulum accumsan, sapien ac tempor hendrerit, lacus odio
sollicitudin ex, sed ullamcorper ipsum dui pellentesque lectus.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Suspendisse non molestie enim. Praesent et gravida ante. Nam semper ipsum
eros, vel euismod mi posuere
commodo. Pellentesque ut ullamcorper nulla. Nam euismod,
nisl quis luctus lobortis, mi enim viverra enim, eget vulputate nibh purus at ex.
Quisque vel magna egestas, gravida nunc sit amet, luctus metus. Aliquam erat volutpat.
Maecenas accumsan urna id est interdum, quis scelerisque ante vehicula. Duis varius
dolor nec ante iaculis fermentum.
Quisque vel magna egestas
Nam semper ipsum eros, vel euismod mi posuere commodo. Pellentesque ut ullamcorper nulla. Nam euismod, nisl quis luctus lobortis, mi enim viverra enim, eget vulputate nibh purus at ex. Quisque vel magna egestas, gravida nunc sit amet, luctus metus. Aliquam erat volutpat. Maecenas accumsan urna id est interdum, quis scelerisque ante vehicula.
- Quisque vel dolor sed leo fringilla euismod;
- Vivamus ultricies libero vestibulum dui euismod, eget gravida lorem interdum;
- Vivamus feugiat mattis ipsum sed vulputate. Maecenas efficitur metus vitae urna eleifend, quis vulputate purus ultrices. Donec vestibulum congue justo, eu finibus augue fermentum id.
- Ut varius tincidunt justo a convallis. Suspendisse elit eros, faucibus vel sem egestas, tempor blandit sem.
Suspendisse non molestie enim. Praesent et gravida ante. Nam semper ipsum eros,
vel euismod mi
vosuere commodo. Pellentesque ut ullamcorper nulla. Nam euismod, nisl quis luctus lobortis,mi enim
viverra enim, eget vulputate nibh purus at ex.
Maecenas efficitur metus vitae
Nam semper ipsum eros, vel euismod mi posuere commodo. Pellentesque ut ullamcorper nulla. Nam euismod, nisl quis luctus lobortis, mi enim viverra enim, eget vulputate nibh purus at ex. Quisque vel magna egestas, gravida nunc sit amet, luctus metus. Aliquam erat volutpat. Maecenas accumsan urna id est interdum, quis scelerisque ante vehicula.
- Quisque vel dolor sed leo fringilla euismod;
- Vivamus ultricies libero vestibulum dui euismod, eget gravida lorem interdum;
- Vivamus feugiat mattis ipsum sed vulputate. Maecenas efficitur metus vitae urna eleifend, quis vulputate purus ultrices. Donec vestibulum congue justo, eu finibus augue fermentum id.
- Ut varius tincidunt justo a convallis. Suspendisse elit eros, faucibus vel sem egestas, tempor blandit sem.
Code snippet with line numbers:
1
2
mock_instance = mock_A.return_value
mock_instance.say_hello.return_value = "hello!"
Code snippet without line numbers:
This is challenging to style because of the way the Rouge library renders code snippets without line numbers vs the way it renders snippets with line numbers.
Code snippet using Markdown-style triple backticks
mock_instance = mock_A.return_value
mock_instance.say_hello.return_value = "hello!"
Code snippet with line numbers via include:
1
2
3
4
5
# _includes/code-snippets/autottest-post/s01_hello_world.py
def hello_world():
return "Hello, world!"
Div with “terminal” class:
21:01:04 blog.1 | started with pid 88969 21:01:04 resume.1 | started with pid 88970 21:01:04 snippets.1 | started with pid 88971
Code snippet with more than 10 lines:
1
2
3
4
5
6
7
8
9
10
11
12
mock_instance = mock_A.return_value
mock_instance.say_hello.return_value = "hello!"
mock_instance = mock_A.return_value
mock_instance = mock_A.return_value
mock_instance = mock_A.return_value
mock_instance = mock_A.return_value
mock_instance = mock_A.return_value
mock_instance.say_hello.return_value = "hello!"
mock_instance.say_hello.return_value = "hello!"
mock_instance.say_hello.return_value = "hello!"
mock_instance.say_hello.return_value = "hello!"
mock_instance.say_hello.return_value = "hello!"
YAML:
1
2
3
4
5
6
7
8
---
name: relaxdiego
description: Mark Maglana's Technical Blog
url: https://www.relaxdiego.com
enforce_ssl: www.relaxdiego.com
permalink: /:year/:month/:title.html
highlighter: rouge
markdown: kramdown
More Python:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# test_module2.py
from mock import patch
from module2 import B
class TestB:
@patch('module2.A')
def test_initialization(self, mock_A):
# Mock A's do_something() method
mock_A.do_something.return_value = True
subject = B()
# Check if B called A.do_something() correctly
mock_A.do_something.assert_called_once_with('foo')
Ruby:
1
2
3
4
5
6
7
8
9
10
11
12
13
# From https://www.rubyguides.com/2019/02/ruby-code-examples/
def find_missing(sequence)
consecutive = sequence.each_cons(2)
differences = consecutive.map { |a,b| b - a }
sequence = differences.max_by { |n| differences.count(n) }
missing_between = consecutive.find { |a,b| (b - a) != sequence }
missing_between.first + sequence
end
find_missing([2,4,6,10])
YAML again. Really long.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
Description: Deceptively simple project
Resources:
Instance1:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref Instance1AmiId
KeyName: !Ref Instance1KeyName
NetworkInterfaces:
- AssociatePublicIpAddress: "true"
DeviceIndex: "0"
GroupSet:
- !Ref Instance1SecurityGroup
SubnetId: !Ref Instance1SubnetId
Tags:
- Key: Name
Value: !Join [ '-', [ !Ref AWS::StackName, !Ref Stage, 'Instance1' ] ]
Instance1SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: !Join [ '-', [ !Ref AWS::StackName, !Ref Stage, 'Instance1-sg' ] ]
VpcId: !Ref Instance1VpcId
SecurityGroupEgress:
- CidrIp: "0.0.0.0/0"
FromPort: -1
ToPort: -1
IpProtocol: -1
Instance2:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref Instance2AmiId
KeyName: !Ref Instance2KeyName
NetworkInterfaces:
- AssociatePublicIpAddress: "true"
DeviceIndex: "0"
GroupSet:
- !Ref Instance2SecurityGroup
SubnetId: !Ref Instance2SubnetId
Tags:
- Key: Name
Value: !Join [ '-', [ !Ref AWS::StackName, !Ref Stage, 'Instance2' ] ]
Instance2SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: !Join [ '-', [ !Ref AWS::StackName, !Ref Stage, 'Instance2-sg' ] ]
VpcId: !Ref Instance2VpcId
SecurityGroupEgress:
- CidrIp: "0.0.0.0/0"
FromPort: -1
ToPort: -1
IpProtocol: -1
SecurityGroupIngress:
#
# Add this missing security group rule
#
- IpProtocol: tcp
FromPort: 8080
ToPort: 8080
SourceSecurityGroupId: !GetAtt Instance1SecurityGroup.GroupId
Analyzer:
Type: AWS::EC2::NetworkInsightsPath
Properties:
Source: !Ref Instance1
Destination: !Ref Instance2
DestinationPort: 8080
Protocol: tcp
Tags:
- Key: Name
Value: !Join [ '-', [ !Ref AWS::StackName, !Ref Stage, 'analyzer' ] ]
Parameters:
Stage:
Description: The stage (dev, staging, production) of the stack
Type: String
Instance1VpcId:
Description: The VPC where Instance1 is to be deployed
Type: String
Instance1AmiId:
Description: The AMI to use for Instance1
Type: String
Instance1KeyName:
Description: The name (not the ID) of the ssh pubkey to inject into Instance1
Type: String
Instance1SubnetId:
Description: The subnet to place Instance1 in
Type: String
Instance2VpcId:
Description: The VPC where Instance2 is to be deployed
Type: String
Instance2AmiId:
Description: The AMI to use for Instance2
Type: String
Instance2KeyName:
Description: The name (not the ID) of the ssh pubkey to inject into Instance2
Type: String
Instance2SubnetId:
Description: The subnet to place Instance2 in
Type: String