Skip to content

Instantly share code, notes, and snippets.

@gschizas
gschizas / FixVirtualNetworkAdapters.ps1
Created February 15, 2013 05:11
Fix virtual network adapters
# see http://msdn2.microsoft.com/en-us/library/bb201634.aspx
#
# *NdisDeviceType
#
# The type of the device. The default value is zero, which indicates a standard
# networking device that connects to a network.
#
# Set *NdisDeviceType to NDIS_DEVICE_TYPE_ENDPOINT (1) if this device is an
# endpoint device and is not a true network interface that connects to a network.
# For example, you must specify NDIS_DEVICE_TYPE_ENDPOINT for devices such as
@gschizas
gschizas / requestsprogress.py
Created September 16, 2012 11:04
Requests with progressbar in python
r = requests.get(file_url)
size = int(r.headers['Content-Length'].strip())
self.bytes = 0
widgets = [name, ": ", Bar(marker="|", left="[", right=" "),
Percentage(), " ", FileTransferSpeed(), "] ",
self,
" of {0}MB".format(str(round(size / 1024 / 1024, 2))[:4])]
pbar = ProgressBar(widgets=widgets, maxval=size).start()
file = []
for buf in r.iter_content(1024):
@gschizas
gschizas / pythonproxy.py
Created September 16, 2012 11:03
A python proxy in less than 100 lines of code
#!/usr/bin/python
# This is a simple port-forward / proxy, written using only the default python
# library. If you want to make a suggestion or fix something you can contact-me
# at voorloop_at_gmail.com
# Distributed over IDC(I Don't Care) license
# http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-lines-of-code/
import socket
import select
import time
import sys
@gschizas
gschizas / autorename.sql
Created September 15, 2012 18:22
Automatically rename a SQL Server based on the current computer host name
/*
This script can be used to automatically rename a SQL Server
based on the current computer host name
Run this script after:
Computer Name Changed
Virtual Machine Cloned
*/
DECLARE
@gschizas
gschizas / spell.py
Created November 23, 2011 20:05
Spell almost any email in NATO phonetic alphabet
#!/usr/bin/python
# -*- coding: utf-8 -*-
# inspired by a comment in http://redd.it/mmr8m
import sys
letters = {' ': 'space',
'a': 'alfa', 'b': 'bravo', 'c': 'charlie', 'd': 'delta',