<description>[\w\s\n&\.\-,;]*</description>
Sunday, 9 September 2018
Monday, 27 August 2018
perl cli regex
perl -pe 's/^(.+)\/([^\s]+)\-([v0-9.]+)\-*([Final|GA|M2|rc|beta|R5]*).jar$/$2\t$3\t$4/'
Saturday, 23 June 2018
key git book pages to read
- https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
- https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows
Sunday, 10 June 2018
packer: virtualbox
Prep
ex001.json
- Vagrant
- vagrant init hashicorp/precise64
- vagrant up
- vagrant destroy -f
Generate
- Packer
- find ~/.vagrant.d/ -name '*ovf' -ls | grep hashi
- create ex001.json
- see below
- fix "source_path" to ovf file to match your system
- packer validate ex001.json
- packer build ex001.json
- vagrant box add my-box-001 packer_virtualbox-ovf_virtualbox.box --force
Test
- mkdir test001
- cd test001
- vagrant init
- in generated "Vagrantfile", change 1st line to 2nd line
- config.vm.box = "base"
- config.vm.box = "my-box-001"
- vagrant up
- vagrant ssh
- cat /var/tmp/welcome.txt
- should say, "welcome001"
- vagrant destroy -f
Cleanup
- vagrant box remove my-box-001 --force
- vagrant box remove hashicorp/precise64 --force
ex001.json
{
"builders": [{
"type": "virtualbox-ovf",
"source_path": "<path to your home dir>/.vagrant.d//boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box.ovf",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}],
"provisioners": [
{
"type": "shell",
"inline":[ "echo welcome001 > /var/tmp/welcome.txt" ]
}
],
"post-processors": ["vagrant"]
}
"builders": [{
"type": "virtualbox-ovf",
"source_path": "<path to your home dir>/.vagrant.d//boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box.ovf",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}],
"provisioners": [
{
"type": "shell",
"inline":[ "echo welcome001 > /var/tmp/welcome.txt" ]
}
],
"post-processors": ["vagrant"]
}
Monday, 16 April 2018
end is nigh: serverless
"For a small company focused on rapid growth, the last thing we wanted to deal with was disk space and memory management, logging agents, security patches, operating system updates, and other traditional server management processes."
Thursday, 12 April 2018
recursive
def recursive_countdown(x):
print('Countdown: ' + str(x))
if x == 1:
return 1
else:
return recursive_countdown(x - 1)
recursive_countdown(5)
def recursive_fib(x):
#print('Fib: ' + str(x))
if x in [0, 1]:
return x
else:
return (recursive_fib(x - 1) + recursive_fib(x -2 ))
# this algo can be easily improved if answers are indexed
print(recursive_fib(5))
print(recursive_fib(6))
print(recursive_fib(7))
print(recursive_fib(8))
print('Countdown: ' + str(x))
if x == 1:
return 1
else:
return recursive_countdown(x - 1)
recursive_countdown(5)
def recursive_fib(x):
#print('Fib: ' + str(x))
if x in [0, 1]:
return x
else:
return (recursive_fib(x - 1) + recursive_fib(x -2 ))
# this algo can be easily improved if answers are indexed
print(recursive_fib(5))
print(recursive_fib(6))
print(recursive_fib(7))
print(recursive_fib(8))
Wednesday, 11 April 2018
Python: sort by value then key
No idea yet how this works, or why.
>>> d = {'apple': 7, 'banana': 3, 'almond': 7, 'peach': 4, 'beetroot': 3}
>>> sorted(d.iteritems(), key=lambda(k, v): (-v, k))
[('almond', 7), ('apple', 7), ('peach', 4), ('banana', 3), ('beetroot', 3)]
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
CRITICAL: AWS now offers internal VPC DNS! Below is no longer necessary AFAIK. Woo hoo! http://aws.amazon.com/about-aws/whats-new/2014/...
-
build sudo apt-get install git gcc sudo apt-get install automake autoconf git clone git://github.com/rriley/tsunami-udp.git cd tsunam...
-
From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4 Assumptions: jEdit was installed into /Applications directory. Close any...