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 argparse | |
import json | |
import re | |
import sys | |
import uuid | |
class OpenVPNNetworkConfiguration(object): | |
KNOWN_CONFIG_KEYS = { | |
'name': {'key': 'Name'}, |
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
# get the SHA-1 digest of the subjectPublicKeyInfo of a certificate as used by Chromium's preloaded public key pinning | |
# http://src.chromium.org/viewvc/chrome/trunk/src/net/http/transport_security_state_static.h?r1=191212&r2=191211&pathrev=191212 | |
curl -s https://pki.google.com/GIAG2.crt | openssl x509 -inform der -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha1 | |
# (stdin)= 43dad630ee53f8a980ca6efd85f46aa37990e0ea | |
# get the base64-encoded SHA-256 digest of the subjectPublicKeyInfo of a certificate as used by HTTP Public Key Pinning | |
# (http://tools.ietf.org/html/draft-ietf-websec-key-pinning-11) | |
curl -s https://pki.google.com/GIAG2.crt | openssl x509 -inform der -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64 | |
# 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= |
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
-- started based on https://gist.github.com/z4yx/218116240e2759759b239d16fed787ca | |
cbor = Dissector.get("cbor") | |
iso7816 = Dissector.get("iso7816") | |
ctaphid_proto = Proto("CTAPHID","FIDO Client to Authenticator Protocol over USB HID") | |
ctaphidfield_cid = ProtoField.uint32("ctaphid.cid", "Channel ID", base.HEX) | |
ctaphidfield_cmd = ProtoField.uint8("ctaphid.cmd", "Command", base.HEX) | |
ctaphidfield_bcnt = ProtoField.uint16("ctaphid.bcnt", "Payload Length", base.DEC_HEX) | |
ctaphidfield_seq = ProtoField.uint8("ctaphid.seq", "Packet Sequence", base.HEX) |
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
def compute_check_digit(str) | |
str = str.strip.upcase | |
values = str.chars.map do |char| | |
case char | |
when '<' | |
0 | |
when 'A'..'Z' | |
char.ord - 65 + 10 | |
when '0'..'9' | |
char.ord - 48 |
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
kubectl get clusterroles admin --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/admin.json | |
kubectl get clusterroles edit --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/edit.json | |
kubectl get clusterroles view --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/view.json | |
vimdiff /tmp/edit.json /tmp/admin.json | |
vimdiff /tmp/view.json /tmp/edit.json |
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
# check for open ports in security groups | |
aws ec2 describe-security-groups | jq '.SecurityGroups | map(select(.IpPermissions[] | select(.FromPort >= 443 and .ToPort <= 443))) |
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 ruby | |
require 'stripe' | |
Stripe.api_key = 'API_KEY' | |
customers_by_coupon = {} | |
customer_count = nil | |
batch_count = 100 | |
batch_offset = 0 |
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
match_latencies = c( | |
7.47978949546814, 6.318617582321167, 6.1188719272613525, 7.745437145233154, | |
..., | |
2.361427068710327, 3.1125471591949463) | |
nomatch_latencies = c( | |
1.8395578861236572, 1.9002978801727295, 2.7614076137542725, 4.611708402633667, | |
..., | |
2.752995729446411, 5.312501907348633) |
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
require 'benchmark' | |
NUM_TRIALS = 10_000_000 | |
Benchmark.bm(20) do |x| | |
x.report('no concatenation') do | |
NUM_TRIALS.times do | |
y = "onetwothree" | |
end | |
end |
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
# based on fist example at http://wulczer.github.com/txpostgres/usage.html | |
import socket | |
import sys | |
from txpostgres import txpostgres | |
from twisted.internet import reactor, stdio | |
from twisted.python import log, util | |
from twisted.protocols import basic |
NewerOlder