This file contains hidden or 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
$ curl -v https://www.x.co/ --resolve www.x.co:443:23.236.62.147 | |
* Added www.x.co:443:23.236.62.147 to DNS cache | |
* Hostname www.x.co was found in DNS cache | |
* Trying 23.236.62.147... | |
* TCP_NODELAY set | |
* Connected to www.x.co (23.236.62.147) port 443 (#0) | |
* ALPN, offering h2 | |
* ALPN, offering http/1.1 | |
* successfully set certificate verify locations: | |
* CAfile: /etc/ssl/cert.pem |
This file contains hidden or 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
""" | |
Context manager for environment variables | |
Usage: | |
os.environ['MYVAR'] = 'oldvalue' | |
with EnvironmentContex(MYVAR='myvalue', MYVAR2='myvalue2'): | |
print os.getenv('MYVAR') # Should print myvalue. | |
print os.getenv('MYVAR2') # Should print myvalue2. |
This file contains hidden or 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 python2 | |
import SimpleHTTPServer | |
import SocketServer | |
import logging | |
PORT = 8000 | |
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |
This file contains hidden or 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
$ErrorActionPreference = "Stop" | |
#Need to install Nuget packages before execute | |
Add-Type -Path (Join-Path (Split-Path $profile -Parent) "packages\Windows7APICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll" -Resolve) | |
Add-Type -Path (Join-Path (Split-Path $profile -Parent) "\packages\Windows7APICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll" -Resolve) | |
<# | |
#TODO: Define Interop code to register shortcut with appid | |
$referencedAssemblies = @( | |
[MS.WindowsAPICodePack.Internal.PropVariant].Assembly.FullName, |
This file contains hidden or 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
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
# generate server.xml with the following command: | |
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
# run as follows: | |
# python simple-https-server.py | |
# then in your browser, visit: | |
# https://localhost:4443 | |
import BaseHTTPServer, SimpleHTTPServer | |
import ssl |
This file contains hidden or 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
# setup named pipes for wine<->linux shell communication | |
# | |
# APPLICATIONS: glue linux & wine, use linux in .bat scripts, system() C-calls etc | |
# USAGE: | |
# | |
# [linux] | |
# mkfifo /tmp/wine_in | |
# mkfifo /tmp/wine_out | |
# ./winetalk /tmp/wine_in /tmp/wine_out | |
# |