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
# This will succeed if applied as an update over https://gist.github.com/gibizer/a0c4e5dc4a59ed3217f64c04a8f207a4 | |
# if there are still free resource on the compute as neutron allows replacing a qos policy on a bound port and does | |
# the necessary allocation update in placement. | |
heat_template_version: wallaby | |
resources: | |
net0: | |
type: OS::Neutron::ProviderNet | |
properties: | |
name: net0 |
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
# This will fail is used as an update over https://gist.github.com/gibizer/a0c4e5dc4a59ed3217f64c04a8f207a4 as | |
# neutron does not support changing a qos rule if that is used by a bound port | |
heat_template_version: wallaby | |
resources: | |
net0: | |
type: OS::Neutron::ProviderNet | |
properties: | |
name: net0 | |
network_type: vlan |
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
heat_template_version: wallaby | |
resources: | |
net0: | |
type: OS::Neutron::ProviderNet | |
properties: | |
name: net0 | |
network_type: vlan | |
physical_network: physnet0 | |
segmentation_id: 100 |
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 openstack | |
def main(): | |
cloud = openstack.connect() | |
projects = cloud.list_projects() | |
for project in projects: | |
print('project_id:', project['id']) | |
floating_ips = cloud.list_floating_ips( | |
filters={"project_id": project["id"]}, |
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
// ==UserScript== | |
// @name opendev gerrit CI table | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description | |
// @author gibi | |
// @match https://review.opendev.org/c/* | |
// @grant none | |
// ==/UserScript== |
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 unittest | |
from unittest import mock | |
class System: | |
def __init__(self): | |
self.counter1 = 0 | |
self.counter2 = 0 | |
def foo(self): |
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 dataclasses | |
@dataclasses.dataclass | |
class Animal: | |
name: str | |
likeable: bool = True | |
class Cat(Animal): | |
color: str |
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
//! # A generic threaded pipeline | |
use std::fmt::Display; | |
use std::sync::mpsc; | |
use std::thread; | |
use std::time::Duration; | |
use log::{error, info}; | |
use log_panics; |
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
//! # Counting word frequncy in text | |
use std::collections::HashMap; | |
use std::fs::File; | |
use std::io::Read; | |
fn get_word_freq<R: Read>(input: &mut R) -> HashMap<String, u32> { | |
let mut text = String::new(); | |
// TODO: avoid reading the whole input into memory here | |
// TODO: would be nicer to return a Result<HashMap..., Err> instead of | |
// panic on non utf-8 input |
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 collections | |
counter = collections.Counter() | |
word = "" | |
with open('sherlock.txt') as f: | |
while True: | |
c = f.read(1) | |
if not c: | |
break | |
if c.isalnum(): |