Skip to content

Instantly share code, notes, and snippets.

@joe-niland
joe-niland / sqlite-to-mysql.py
Last active May 31, 2021 08:45 — forked from rednebmas/convert.py
Convert sqlite3 dump to mysql importable statements
#!/usr/bin/env python3
import re
import fileinput
print("SET FOREIGN_KEY_CHECKS=0;")
def main():
for line in fileinput.input():
@uid0
uid0 / onstart.hook
Created August 6, 2020 05:51
Taskwarrior On-Modify Hook for 'stup' integration
import sys
import json
import os
# Hook should extract all of the following for use as Timewarrior tags:
# UUID
# Project
# Tags
# Description
# UDAs
@AoJ
AoJ / HAclustering.md
Created June 17, 2020 09:30
High Availability (HA) and Clustering: 2-Node (Master / Slave) PostgreSQL Cluster
@wipash
wipash / Create-VM-cloud-init.ps1
Last active December 15, 2023 21:39
Create Linux VM on Hyper-V with cloud-init
<#
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
<#
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
@secretrob
secretrob / gitlab_to_jira.py
Last active March 28, 2024 10:33 — forked from mvisonneau/gitlab_to_jira.py
GitLab to Jira issue sync
#!/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 )
@mdiener21
mdiener21 / round_minutes_to_quarter_hour.py
Last active April 4, 2024 09:05
Python round minutes to the nearest quarter hour
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
@mcastelino
mcastelino / qemu_netdev_socket_vlan.md
Last active December 21, 2023 13:20
QEMU usermode virtual vlan using -netdev socket

Goal

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

@romainl
romainl / vanilla-linter.md
Last active May 6, 2024 01:48
Linting your code, the vanilla way

Linting your code, the vanilla way

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.

Defining makeprg

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.

@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active April 24, 2024 00:11
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl