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
# Creates a virtual machine and builds the EDK2 source | |
# VirtualBox and Vagrant must be installed first | |
vagrant box add base http://files.vagrantup.com/precise64.box | |
vagrant init | |
vagrant up | |
vagrant ssh | |
sudo apt-get update | |
sudo apt-get install build-essential git uuid-dev iasl | |
git clone https://github.com/curzona/edk2.git |
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
dict(zip(d.values(), d.keys())) |
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
class Struct: | |
def __init__(self, **entries): | |
for k, v in entries.items(): | |
if isinstance(v, dict): | |
entries[k] = Struct(**v) | |
self.__dict__.update(entries) | |
d = {'a':{'b':1, 'c':2}, 'd':1} | |
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 sys | |
import time | |
import logging | |
class Logger(logging.Logger): | |
indent = 0 | |
def __init__(self, name, level=logging.NOTSET): | |
logging.Logger.__init__(self, name, level) | |
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 sys | |
import socket | |
from threading import Thread | |
if sys.version_info >= (3,0): | |
from xmlrpc.server import SimpleXMLRPCServer | |
from xmlrpc.client import ServerProxy | |
else: | |
from SimpleXMLRPCServer import SimpleXMLRPCServer | |
from xmlrpclib import ServerProxy |
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 ConfigParser | |
def parser_config(filename): | |
dict = {} | |
config = ConfigParser.ConfigParser() | |
config.optionxform = str | |
config.read(filename) | |
for section in config.sections(): |
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 sys | |
import time | |
import logging | |
class Logger(logging.Logger): | |
indent = 0 | |
def __init__(self, name, level=logging.NOTSET): | |
logging.Logger.__init__(self, name, level) | |
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 sys | |
import types | |
castor = {types.IntType:int, types.LongType:long, types.FloatType:float, types.BooleanType:bool} | |
def ask(message, default): | |
sys.stdout.write(message + " [" + str(default) + "]:") | |
input = sys.stdin.readline().strip() | |
if input == "": |
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 sys | |
from optparse import OptionParser | |
def command(options, args): | |
function, parameters = args[0], args[1:] | |
print "You typed: {0}({1})".format(function, parameters) | |
def interactive(options, args): | |
print "Python interactive window. Type $help for a list of commands." |
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
// Extended DateTime constants and strinify | |
class DateTimeEx | |
{ | |
public static DateTime NextYear { get { return DateTime.Today.AddDays(-DateTime.Today.DayOfYear + 1).AddYears(1); } } | |
public static DateTime NextMonth { get { return DateTime.Today.AddDays(-DateTime.Today.Day + 1).AddMonths(1); } } | |
public static DateTime NextWeek { get { return DateTime.Today.AddDays(7 - (DateTime.Today.DayOfWeek - CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek)); } } | |
public static DateTime Tomorrow { get { return DateTime.Today.AddDays(1); } } | |
public static DateTime Now { get { return DateTime.Now; } } | |
public static DateTime Today { get { return DateTime.Today; } } | |
public static DateTime Yesterday { get { return DateTime.Today.AddDays(-1); } } |
OlderNewer