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
const myOriginalContent = 'Montreal (CA: /ˌmʌntriˈɔːl/ ⓘ MUN-tree-AWL; French: Montréal [mɔ̃ʁeal] ⓘ) is the largest city in the province of Quebec, the second-largest in Canada, and the tenth-largest in North America. Founded in 1642 as Ville-Marie, or "City of Mary",[15] it is now named after Mount Royal,[16] the triple-peaked hill around which the early settlement was built.[17] The city is centred on the Island of Montreal[18][19] and a few much smaller peripheral islands, the largest of which is Île Bizard. The city is 196 km (122 mi) east of the national capital, Ottawa, and 258 km (160 mi) southwest of the provincial capital, Quebec City. '; | |
const re = /(Montr.al|Ottawa|Quebec)/g; | |
var mapping = new Map<string, string>; | |
function getAnoValue(secret) { | |
if (mapping.get(secret) === undefined) { | |
mapping.set(secret, `city${Math.floor(Math.random() * Math.pow(2, 20))}`); |
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 | |
from datetime import timedelta | |
from django.utils import timezone | |
from oauth2_provider.models import AccessToken | |
from oauthlib.common import generate_token | |
def rotate_token(token_string): | |
current_token = AccessToken.objects.filter(token=token_string).first() | |
if not current_token: |
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 time | |
from sentence_transformers import SentenceTransformer | |
model = SentenceTransformer( | |
f"sentence-transformers/all-MiniLM-L6-v2", device="cpu" | |
) | |
suggestion = """ | |
- name: Git checkout | |
ansible.builtin.git: | |
accept_newhostkey: true |
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
#!/bin/bash | |
set -eux | |
function cleanup() | |
{ | |
echo "Something went wrong! Let's clean up." | |
} | |
trap cleanup EXIT |
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
# | |
# (c) 2022 Red Hat Inc. | |
# | |
# This file is part of Ansible | |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
import pytest |
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 argparse | |
from datetime import datetime | |
import requests | |
import re | |
class TimedOut(Exception): |
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 boto3 | |
from datetime import datetime | |
client = boto3.client("cloudtrail") | |
import json | |
instances = {} |
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 | |
# Identify the minimal subset of permission required for a given Ansible playbook | |
# License: GPLv3+ | |
# Copyright: Gonéri Le Bouder <[email protected]> | |
from pyVmomi import vim | |
from pyVim.connect import SmartConnect, SmartConnectNoSSL, Disconnect | |
import os | |
import subprocess |
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
sudo qemu-img convert -c -p -f qcow2 -O vmdk -o subformat=streamOptimized,compat6 ubuntu-2004.qcow2 ~/tmp/ubuntu-2004.vmdk-4 | |
scp ~/tmp/ubuntu-2004.vmdk-4 [email protected]:/srv/share/vms/test_vm1 | |
ssh [email protected] vmkfstools -i /vmfs/volumes/rw_datastore/test_vm1/ubuntu-2004.vmdk-4 /vmfs/volumes/rw_datastore/test_vm1/ubuntu-2004.vmdk -d thin | |
ssh [email protected] curl -o /srv/share/vms/fedora-35.vmdk-4 https://s3.us-east-2.amazonaws.com/ansible-team-cloud-images/fedora-35.vmdk-4 | |
ssh [email protected] mkdir -p /vmfs/volumes/rw_datastore/test_vm1 | |
ssh [email protected] vmkfstools -i /vmfs/volumes/local/fedora-35.vmdk-4 /vmfs/volumes/rw_datastore/test_vm1/fedora-35.vmdk -d thin |
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
#!/bin/bash | |
job_id=$(uuidgen) | |
ansible_core_ci=$(cat ~/.ansible-core-ci.key) | |
curl -X PUT -H "Content-Type: application/json" --data '{"config": {"platform": "azure"}, "auth": {"remote": {"key": "'${ansible_core_ci}'", "nonce": null}}, "threshold": 1}' https://ansible-core-ci.testing.ansible.com/dev/azure/${job_id}| python -c 'import yaml, sys; print(yaml.dump(yaml.safe_load(sys.stdin), default_flow_style=False))' |tee session.yaml |
NewerOlder