Skip to content

Instantly share code, notes, and snippets.

@teroka
teroka / dell_warranty.py
Created November 8, 2014 19:38
Dell API: Warranty Information
#!/usr/bin/env python
# Quick script to check your Dell asset's warranty status
# Just drop your service tag as parameters for the script and go.
import sys
import requests
APIKEY = 'd676cf6e1e0ceb8fd14e8cb69acd812d'
URL = 'https://api.dell.com/support/v2/assetinfo/warranty/tags.json?svctags={0}&apikey=' + APIKEY
@teroka
teroka / dell_specs.py
Created November 8, 2014 19:23
Dell API: Original Config for Hardware
#!/usr/bin/env python
# Script to query Dell's API for the hardware's original config.
# Just drop your service tag as parameters for the script and go.
import sys
import requests
APIKEY = 'd676cf6e1e0ceb8fd14e8cb69acd812d'
URL = 'https://api.dell.com/support/v2/assetinfo/detail/tags.json?svctags={0}&apikey=' + APIKEY
@teroka
teroka / gist:7991878
Created December 16, 2013 18:31
rewriting docs
# Copyright (C) Cfengine AS
# This file is part of Cfengine 3 - written and maintained by Cfengine AS.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 3.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@teroka
teroka / gist:7928277
Last active December 31, 2015 03:29
regarray() bug?
body common control { bundlesequence => { "example1", "example2" }; }
bundle agent example1
{
vars:
"myarray[0]" string => "bla1";
"myarray[1]" string => "bla2";
"myarray[3]" string => "bla";
classes:
"ok" expression => regarray("myarray","b.*2");
@teroka
teroka / hosts_updater.py
Created September 28, 2013 13:10
Glue to keep specific entries up to date in /etc/hosts
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Superglue to keep /etc/hosts up-to-date of given entries.
If the entry doesn't exists, we won't add it. We only keep
the EXISTING entries updated.
* depends on python-dnspython
@teroka
teroka / gist:6200812
Created August 10, 2013 15:18
ifelse() bug?
body common control { bundlesequence => { "example" }; }
bundle agent example {
vars:
"foo[1]" string => "foo[1]";
"foo[2]" string => "foo[2]";
"foo[default]" string => "foo[default]";
"randomvar" string => "foobar";
secondpass::
body common control
{
bundlesequence => { "test_apt" };
inputs => { "cfengine_stdlib.cf" };
}
bundle agent test_apt
{
vars:
"curver" string => "23.3+1-1ubuntu9.2";