dump gnome terminal settings
dconf dump /org/gnome/terminal/legacy/profiles:/
[:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
| import subprocess | |
| def cmd_run(cmd): | |
| if isinstance(cmd, str): | |
| cmd = cmd.split() | |
| if not isinstance(cmd, list): | |
| raise Exception("TypeError cmd_run only accept str,list") | |
| p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| out, err = p.communicate() |
| import __builtin__ | |
| openfiles = set() | |
| oldfile = __builtin__.file | |
| class newfile(oldfile): | |
| def __init__(self, *args): | |
| self.x = args[0] | |
| print "\033[01;31m##### %d #### OPENING %s ###\033[00m" % (len(openfiles),str(self.x)) |
| ## | |
| # You should look at the following URL's in order to grasp a solid understanding | |
| # of Nginx configuration files in order to fully unleash the power of Nginx. | |
| # http://wiki.nginx.org/Pitfalls | |
| # http://wiki.nginx.org/QuickStart | |
| # http://wiki.nginx.org/Configuration | |
| # | |
| # Generally, you will want to move this file somewhere, and start with a clean | |
| # file but keep this around for reference. Or just disable in sites-enabled. | |
| # |
| import sys | |
| import socket | |
| import struct | |
| def wake_on_lan(macaddress): | |
| """ Switches on remote computers using WOL. """ | |
| # Check macaddress format and try to compensate. | |
| if len(macaddress) == 12: | |
| pass |
| class NetUtils: | |
| @classmethod | |
| def CheckInterfaceConnected(cls, inDev): | |
| dev_path = "/sys/class/net/%s" % inDev | |
| carrier_path = dev_path + "/carrier" | |
| opersate_path = dev_path + "/operstate" |
| #!/bin/bash | |
| shopt -s nullglob | |
| for g in $(ls /sys/kernel/iommu_groups); do | |
| echo "IOMMU Group $g" | |
| for d in /sys/kernel/iommu_groups/$g/devices/*; do | |
| n=${d#*/iommu_groups/*}; n=${n%%/*} | |
| ret=`lspci -nns "${d##*/}"` |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import sys | |
| import uuid | |
| import json | |
| import struct | |
| import socket | |
| import logging |
| # kudos to dzaku at consolechars.wordpress.com | |
| ### MOUNT qcow2 image with lvm partitions | |
| # ensure nbd can handle that many partitions | |
| sudo modprobe nbd max_part=8 | |
| # present image as block device through NBD | |
| sudo qemu-nbd --connect=/dev/nbd0 <image.qcow2> |
| import os | |
| import imp | |
| def import_file(module_path): | |
| base_path = os.path.dirname(module_path) | |
| module_name = os.path.basename(module_path).rstrip('.py') | |
| fp, pathname, description = imp.find_module(module_name, [base_path]) | |
| try: |