Skip to content

Instantly share code, notes, and snippets.

View freyes's full-sized avatar
🥑

Felipe Reyes freyes

🥑
View GitHub Profile
@smoser
smoser / README.md
Last active March 30, 2023 18:42
iscsi / ibft booting test

iscsi and iBFT test using qemu/kvm and ipxe

The general goal of this doc is to show how to use qemu, ipxe and tgt to test iscsi and iBFT.

There are loads of things that could be done to make this test environment. But for now, it just shows a simple case to show parameters necessary.

Setting up iscsi test environment

In examples here, the iscsi server is available at 192.168.1.10. The qemu host system is available at 192.168.1.11. We assume port 9999 is available to run a python simple web server.

@wolsen
wolsen / cmadison.py
Last active May 12, 2016 19:18
rmadison + cloud-archive madison
#!/usr/bin/env python
#
# Provides a rather basic version of rmadison (or dak ls if you prefer)
# for the Ubuntu cloud-archive.
#
# This script works in the following manner:
# 1) It will show the rmadison output for the selected package to show
# the values of packages within the main ubuntu archives
# 2) It will show similar output for the selected package in the ubuntu
# cloud archives.
@niedbalski
niedbalski / manual-juju.sh
Last active August 16, 2019 07:58
Setup a ISCSI target multipath with Juju
$ juju bootstrap -e openstack_env
$ juju add-machine
$ nova interface-attach be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
$ nova interface-list be8c7ed3-9f5c-41f8-b596-0ae7f35c773d
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| ACTIVE | 9c58bd7f-324a-490e-881f-65134ba17915 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.30 | fa:16:3e:73:ad:dd |
| ACTIVE | c76d3bf1-9107-4f15-90e2-753c24b219b4 | 2d5c6949-ae3d-4980-99cf-b17dcb56424a | 10.5.1.31 | fa:16:3e:48:a3:4c |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
@niedbalski
niedbalski / netns-lxc.sh
Last active June 22, 2021 03:57
netns-lxc
$ source netns-lxc.sh && sudo veth_interface_for_lxc container_name
veth132
# coding=utf8
"""
salesforce.py - Willie Salesforce Module for displaying
support case information
Copyright 2015, Billy Olsen
Licensed under the Eiffel Forum License 2.
"""
from __future__ import unicode_literals
@niedbalski
niedbalski / deployerizer.py
Last active March 17, 2017 19:14
Convert a current running juju environment to a juju-deployer bundle.
#!/usr/bin/env python
from __future__ import print_function
import yaml
import subprocess
import argparse
__author__ = "Jorge Niedbalski <[email protected]>"
@niedbalski
niedbalski / mongo.sh
Created February 10, 2015 20:20
Connect to Juju Mongodb
$ juju ssh 0
machine-0# sudo apt-get install mongodb-clients
machine-0# mongo --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
MongoDB shell version: 2.4.9
connecting to: localhost:37017/admin
juju:PRIMARY> db = db.getSiblingDB("juju")
juju
anonymous
anonymous / mongodb.sh
Created January 20, 2015 19:28
Jump into a mongodb session ( juju )
$ juju ssh 0
machine-0# sudo apt-get install mongodb-clients
machine-0# mongo --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin
MongoDB shell version: 2.4.9
connecting to: localhost:37017/admin
juju:PRIMARY> db = db.getSiblingDB("juju")
juju
juju:PRIMARY> show collections
constraints
containerRefs
@joeyAghion
joeyAghion / mongodb_collection_sizes.js
Last active June 4, 2025 10:23
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
@niedbalski
niedbalski / auth.py
Created November 9, 2012 21:08
hmac-encrypt-request
from Crypto.Hash import HMAC
from Crypto.Hash import SHA
import hashlib
import datetime
class Auth:
@classmethod
def sign(cls, method, c_type, body, uri, key=None):