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
from azure.devops.connection import Connection | |
from msrest.authentication import BasicAuthentication | |
import os | |
import git | |
''' | |
pip install azure-devops | |
pip install gitpython | |
''' |
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
# Approve-PowershellScripts.ps1 | |
# | |
# requires -version 3 | |
$here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$powershellFiles = Get-ChildItem -Recurse $here -Include '*.ps*' | |
$nonTestFiles = $powershellFiles | Where-Object { -Not ($_.Name.EndsWith('.Tests.ps1')) } | |
$testFiles = $powershellFiles | Where-Object { $_.Name.EndsWith('.Tests.ps1') } | |
$functions = Get-ChildItem -Recurse $here -Include *.ps1 | Where-Object { $_ -notmatch ".Tests.ps1" } |
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
Describe "Description Name" ` | |
{ | |
Context "Context Name #1" ` | |
{ | |
It "..." { ... } | |
} | |
Context "Context Name #2" ` | |
{ | |
It "..." { ... } |
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
#requires -version 4 | |
get-childitem variable: | |
get-module -ListAvailable | |
get-module psake | |
<# | |
Powershell 101 |
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
#! /usr/bin/env python | |
# 2012-01-15: Modified by Adam Porter <adam@alphapapa.net> | |
# Based on md5verify.py by Wil Clouser | |
# <http://micropipes.com/blog/2011/01/30/md5verify-a-script-to-automatically-verify-file-integrity/> | |
# <https://github.com/clouserw/scripts/blob/master/md5verify.py> | |
# Redistribution and use in source and binary forms, with or without modification, | |
# are permitted provided that the following conditions are met: | |
# |
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
""" | |
From: http://wiki.python.org/moin/Twisted-Examples | |
Via: http://stackoverflow.com/questions/4412581 | |
""" | |
from twisted.web import proxy, http | |
from twisted.internet import reactor | |
from twisted.python import log | |
import sys | |
log.startLogging(sys.stdout) |
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
# Basically the problem was that I wanted to create a flat tuple from a tuple and a single value like such: | |
# | |
val = 3 | |
tup = ( 'a', 3.14, "zzz" ) | |
# I wanted this: | |
# | |
# ( 3, 'a', 3.14, "zzz" ) | |
# | |
# not this: |
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 os, sys | |
import Image | |
size = 128, 128 | |
for infile in sys.argv[1:]: | |
outfile = os.path.splitext(infile)[0] + ".thumbnail" | |
if infile != outfile: | |
try: | |
im = Image.open(infile) |
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
from xml.dom.minidom import parse | |
dom = parse("foo.xml") # or dom = parseString( "<myxml>Some data <empty/> some more data</myxml>" ) | |
for node in dom.getElementsByTagName('bar'): # visit every node <bar /> | |
print node.toxml() |
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
if sys.version_info[0] == 3: | |
# Python 3 imports. | |
from urllib.parse import urlparse, parse_qs | |
else: | |
# Python 2 imports. | |
from urlparse import urlparse, parse_qs |
NewerOlder