Skip to content

Instantly share code, notes, and snippets.

View skywalker-nick's full-sized avatar
👀

Nick Ma skywalker-nick

👀
View GitHub Profile
@skywalker-nick
skywalker-nick / gist:4568f9cfcc9ef8d55254a256fc9d8b60
Created October 25, 2023 08:30
Reveal.js footer and header for every page
<style type="text/css">
/* 1. Style header/footer <div> so they are positioned as desired. */
#header-left {
position: absolute;
top: 0%;
left: 0%;
}
#header-right {
position: absolute;
top: 0%;
@skywalker-nick
skywalker-nick / rabbitmq.txt
Created April 28, 2018 09:17 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@skywalker-nick
skywalker-nick / remove-docker-containers.md
Last active November 4, 2016 09:42 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm -f
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@skywalker-nick
skywalker-nick / neutron-ha-tool.py
Created January 31, 2014 06:44
Neutron HA tool for L3 and DHCP agents
#! /usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 AT&T Services, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
@skywalker-nick
skywalker-nick / l3_agent_scheduler.py
Last active August 29, 2015 13:55
Least Utilized Router Scheduler for OpenStack Neutron Havana Release
class LeastUtilizedScheduler(object):
"""Allocate a L3 agent for a new router that is the least utilized
in terms of router count
"""
def auto_schedule_routers(self, plugin, context, host, router_ids):
"""Schedule non-hosted routers to L3 Agent running on host.
If router_ids is given, each router in router_ids is scheduled
if it is not scheduled yet. Otherwise all unscheduled routers
are scheduled.
Don't schedule the routers which are hosted already