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 argparse | |
import pathlib | |
import sys | |
old_bytes = bytes([0x80, 0x79, 0x05, 0x00, 0x0f, 0x94, 0xc2]) | |
new_bytes = bytes([0xc6, 0x41, 0x05, 0x01, 0xb2, 0x00, 0x90]) | |
def main(): | |
parser = argparse.ArgumentParser(description="sublime text patcher") |
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
# filter_plugins/dns.py | |
import dns.zone # pip install dnspython or pipx inject ansible dnspython | |
import dns.resolver | |
import dns.flags | |
def get_dns_serial(zone, ns=None): | |
resolver = dns.resolver.Resolver(configure=True) | |
resolver.use_edns(0, ednsflags=dns.flags.DO, payload=4096) | |
if ns: |
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/python | |
import spwd | |
import subprocess | |
DOCUMENTATION = ''' | |
--- | |
module: lock_user | |
short_description: locks user accounts | |
description: | |
- The M(lock_user) module invokes C(passwd -l) to lock user accounts. |
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
fun! ToggleTerminal() | |
let terms = term_list() | |
if terms == [] " no terminals, open one | |
botright term | |
elseif bufwinnr(terms[0]) == -1 " terminal hidden, show it | |
exec 'botright sbuffer' terms[0] | |
else " terminal visible, hide it | |
exec bufwinnr(terms[0]) .. 'hide' | |
endif | |
endf |
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
use num_integer::lcm; | |
use std::cmp::Ordering; | |
use std::collections::{BinaryHeap, HashMap}; | |
#[derive(Copy, Clone)] | |
pub struct Pos { | |
x: usize, | |
y: usize, | |
} |
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
use lazy_static::lazy_static; | |
use num_enum::{IntoPrimitive, TryFromPrimitive}; | |
use num_integer::gcd; | |
use regex::Regex; | |
use std::collections::{HashMap, VecDeque}; | |
#[repr(u8)] | |
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] | |
pub enum Facing { | |
Right = 0, |
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
use std::collections::HashMap; | |
use num_rational::Rational64; | |
pub type Number = Rational64; | |
#[derive(Debug)] | |
pub enum Expr<'a> { | |
Unknown, | |
Number(Number), | |
Add(&'a str, &'a str), |
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
--- | |
- hosts: all | |
tasks: | |
- group_by: key="{{ 'using_letsencrypt' if letsencrypt_certs|default([]) else 'not_using_letsencrypt' }}" | |
changed_when: no | |
tags: always | |
- group_by: key="{{ ansible_distribution.lower() ~ '_' ~ ansible_distribution_release }}" | |
changed_when: no | |
tags: always |
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 os | |
from units.compat import mock | |
from units.compat import unittest | |
from ansible.modules import apt_key | |
class AptKeyTestCase(unittest.TestCase): |
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/python3 | |
""" | |
Script to remove unused libvirt images left lying around by libvirt-vagrant. | |
This is a workaround for | |
https://github.com/vagrant-libvirt/vagrant-libvirt/issues/85 | |
""" | |
import argparse | |
import functools |
NewerOlder