Skip to content

Instantly share code, notes, and snippets.

@yaronn
yaronn / ws.js.txt
Last active August 29, 2015 13:56
ws.js on windows
//git
cd C:\Users\naveh\Documents\features\projects\ws.js
use git as normal...
//npm
npm config set proxy http://localhost:8888/
npm config set https-proxy http://localhost:8888/
//and open fiddler
npm install -g nodeunit //in case not installed for some reason
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MHService_MHSPort">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://org/emedny/mhs/': -->
<!-- <wsdl:binding name='MHS'> -->
<!-- <dpe:summary xmlns:dpe="http://www.datapower.com/extensions">..</dpe:summary> -->
<!-- <sp:SupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">..</sp:SupportingTokens> -->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mhs="http://org/emedny/mhs/" xmlns:urn="urn:hl7-org:v3">
<soapenv:Header>
<wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-e00c8062-83d2-4f04-88fc-996218e7bb3d">MIICeDCC....(eMedNY signed user MLS cert).......</wsse:BinarySecurityToken>
<wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-s
c.Endpoint.Contract.ProtectionLevel = System.Net.Security.ProtectionLevel.Sign;
@yaronn
yaronn / operation context.cs
Created July 31, 2014 18:17
pass information from encoder to proxy
http://wcfswaencoder.codeplex.com/
http://www.codeplex.com/Download?ProjectName=wcfswaencoder&DownloadId=87250
http://wcfswaencoder.codeplex.com/SourceControl/latest
public override Message ReadMessage(System.IO.Stream stream, int maxSizeOfHeaders, string contentType)
{
VerifyOperationContext();
var select = require('xpath.js')
, dom = require('xmldom').DOMParser
var xml = "<?xml version='1.0' encoding='UTF-8'?>"+
"<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'>"+
" <entry>"+
" <updated>2014-08-19T14:37:34.663Z</updated>"+
" <category scheme='http://schemas.google.com/spreadsheets/2006' term='http://schemas.google.com/spreadsheets/2006#spreadsheet'/>"+
" <title type='text'>Tmp SS</title>"+
" <content type='text'>Tmp SS</content>"+
@yaronn
yaronn / gist:293b39502b1c466afe26
Created October 16, 2014 18:39
c# convert x509 certificate issuer serial from decimal to hex
var z = System.Numerics.BigInteger.Parse("1248141336554058010539064411039");
var x = z.ToString("X4");
@yaronn
yaronn / gist:943849d1f18b63ddf7f2
Last active August 29, 2015 14:16
blessed-contrib gallery
http://hideack.hatenablog.com/entry/2015/01/19/220321
https://github.com/icecrime/docker-mon
https://github.com/jfrazelle/dstats
https://github.com/joola/blessed-contrib/blob/master/examples/joola-dashboard.js
https://github.com/Graylog2/cli-dashboard
https://www.npmjs.com/package/accesslog-monitor
barda
graphite
https://news.ycombinator.com/item?id=8822808
http://www.gizra.com/content/headless-drupal-terminal/
//sign
var SignedXml = require('xml-crypto').SignedXml
, fs = require('fs');
var xml = fs.readFileSync("./x.xml").toString();
var sig = new SignedXml();
sig.addReference("//*[local-name(.)='EntityDescriptor']", ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", "http://www.w3.org/2001/10/xml-exc-c14n#"], "http://www.w3.org/2000/09/xmldsig#sha1", "", "", "", true)
sig.signingKey = fs.readFileSync("./client.pem");
<document>
<page>
<item col="0" row="0" colSpan="5" rowSpan="4">
<bar maxHeight="5" data-titles="A,B,C" data-data="2,5,3" />
</item>
</page>
</document>