Skip to content

Instantly share code, notes, and snippets.

View sakurai-youhei's full-sized avatar

Youhei Sakurai sakurai-youhei

  • Kobe, Japan
View GitHub Profile
@coderofsalvation
coderofsalvation / winetalk
Created July 5, 2012 11:52
winetalk - named pipes for communication between wine and linux bash
# 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
#
# 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
$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,
@phrawzty
phrawzty / 2serv.py
Last active July 22, 2024 13:51
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@devhero
devhero / envcontext.py
Last active February 12, 2019 20:01
A Python context manager for setting/unsetting environment variables
"""
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.
@dweekly
dweekly / WixFail
Created August 26, 2020 06:46
Wix returns an internal TLS server error in the ServerHello when presented with an unknown SNI.
$ 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