This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
set -e | |
readonly VM="banana" | |
readonly CPU="8" | |
readonly MEM="8GB" | |
readonly DSK="120GB" | |
lxc init images:ubuntu/focal ${VM} -p default -p vm --vm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import winreg | |
cmd = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Command Processor', access=winreg.KEY_WRITE) | |
winreg.SetValueEx(cmd, 'AutoRun', 0, winreg.REG_SZ, 'myscript.bat') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@when('config.changed.crictl-version') | |
def crictl_version_changed(): | |
""" | |
crictl version has changed. | |
:return: None | |
""" | |
remove_state('crictl.installed') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cloud-config | |
## launch multipass instance with `--cloud-init [this file]` | |
## then mount your charm workspace with `multipass mount "." "[instance name]:/project"` | |
write_files: | |
- path: /etc/profile.d/charm-dev.sh | |
permissions: "0644" | |
content: | | |
export CHARM_BUILD_DIR=/builds | |
export CHARM_LAYERS_DIR=/layers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
from typing import List | |
def get_packages() -> List[str]: | |
out: str = subprocess.check_output(['pip', 'freeze']).decode() | |
packages: List[str] = out.split('\n') | |
return [x.split('==')[0] for x in packages] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git: | |
source: https://github.com/git/git | |
source-type: git | |
source-depth: 1 | |
plugin: autotools | |
configflags: | |
- --with-curl | |
- --with-expat | |
build-packages: | |
- gettext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_seq_in_list(sequence, match): | |
for i, j in enumerate(sequence): | |
if sequence[i:len(match) + i] == match: | |
return True | |
return False | |
if __name__ == '__main__': | |
match = [1, 3, 4] | |
sequence = [2, 3, 6, 3, 8, 1, 3, 4, 8, 2] | |
is_seq_in_list(sequence, match) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from datetime import datetime | |
def how_old_am_i(year, month, day): | |
""" | |
Get how old you are in years. | |
:param year: Integer year born | |
:param month: Integer month born | |
:param day: Integer day born | |
:retuns: Integer years old |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
twilio "github.com/carlosdp/twiliogo" | |
"net/http" | |
"strings" | |
) | |
var form = []string{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
var form = []string{ | |
"Make", | |
"Model", |
NewerOlder