This file contains 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
#!/usr/bin/env python3 | |
import re | |
import fileinput | |
print("SET FOREIGN_KEY_CHECKS=0;") | |
def main(): | |
for line in fileinput.input(): |
This file contains 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 sys | |
import json | |
import os | |
# Hook should extract all of the following for use as Timewarrior tags: | |
# UUID | |
# Project | |
# Tags | |
# Description | |
# UDAs |
This file contains 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
<# | |
Create Unix VM's. | |
PREREQUISITES: | |
- A VM that has been installed with an OS that supports cloud-init | |
- cloud-init is installed on the vm | |
How it works: | |
- Asks for a bunch of parameters | |
- Creates a disk from parent vhdx for speed |
This file contains 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
<# | |
Create Unix VM's. | |
PREREQUISITES: | |
- A VM that has been installed with an OS that supports cloud-init | |
- cloud-init is installed on the vm | |
How it works: | |
- Asks for a bunch of parameters | |
- Creates a disk from parent vhdx for speed |
This file contains 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
#!/usr/bin/env python | |
import requests | |
import gitlab | |
from jira import JIRA | |
import urllib3 | |
import json | |
## Disable urllib3 ssl checks warnings | |
urllib3.disable_warnings( urllib3.exceptions.InsecureRequestWarning ) |
This file contains 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 round_to_nearest_quarter_hour(minutes, base=15): | |
""" | |
Input: A value in minutes. | |
Return: An integer rounded to the nearest quarter-hour (0, 15, 30, 45) based on the base interval, | |
with special handling to ensure rounding from 0 up to 7 goes to 0 and 8 to 15 round to 15 | |
Example round_to_nearest_quarter_hour(0) rounds to 0 | |
round_to_nearest_quarter_hour(7) rounds to 0 | |
round_to_nearest_quarter_hour(8) rounds to 15 | |
round_to_nearest_quarter_hour(22) rounds to 15 |
How to launch multiple QEMU based VM's that can communicate with the outside world and between each other other without any setup on the host.
This uses two features available in qemu
- User Mode Networking stack - SLIRP
- Socket networking backend allows you to create a network of guests that can see each other
This allows us to have
You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.
autocmd FileType <filetype> setlocal makeprg=<external command>
This autocommand tells Vim to use <external command>
when invoking :make %
in a <filetype>
buffer. You can add as many similar lines as needed for other languages.
My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
NewerOlder