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 python2 | |
from __future__ import print_function | |
from sys import stdin, stderr, stdout | |
import re | |
message = [] | |
message_started = message_ended = None | |
for line in stdin: |
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
"""Example of using hangups to lookup contacts by id.""" | |
import sys | |
import asyncio | |
import hangups | |
# Path where OAuth refresh token is saved, allowing hangups to remember your |
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
# generate your private key, put the public key on the server you will be connecting to | |
ssh-keygen -t rsa -f ./my_key | |
# generate the password/secret you will store encrypted in the .travis.yml and use to encrypt your private key | |
cat /dev/urandom | head -c 10000 | openssl sha1 > ./secret | |
# encrypt your private key using your secret password | |
openssl aes-256-cbc -pass "file:./secret" -in ./my_key -out ./my_key.enc -a | |
# download your Travis-CI public key via the API. eg: https://api.travis-ci.org/repos/travis-ci/travis-ci/key |
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 python3 | |
# This is used for testing openconnect's (https://github.com/dlenski/openconnect). | |
# handling of the atrocious XML+JavaScript mess used for | |
# authenticating to a PAN GlobalProtect VPN. | |
# | |
# Requires a recent version of Flask and Python 3.x, and a server.pem | |
# | |
# Should be fairly easy to tweak to fit various authentication scenarios. |
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 python3 | |
''' | |
Exhaustive solution to | |
https://fivethirtyeight.com/features/the-robot-invasion-has-come-for-our-pool-halls/ | |
Consider 15 standard pool balls arranged in a triangle (7 solids, 7 stripes, one 8-ball). | |
- Solids are all equivalent to each other | |
- Stripes are all equivalent to each other | |
- Robot can perform one of three operations: rotate 120° CW, rotate 120° CCW, swap 2 balls |
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
#!/bin/bash | |
# Takes SN, EXPIRATION, and SEED environment variables | |
# (SEED must be 32 hex digits) and converts them to | |
# an RSA SecurID token in CTF format. | |
# | |
# Requires: | |
# stoken >=v0.9 | |
# perl5 | |
# base64 |
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 | |
# old, Python 2.x only :-( | |
# https://github.com/freedesktop/python-geoclue | |
from __future__ import print_function | |
import Geoclue | |
from datetime import datetime | |
print("Geoclue version %s" % Geoclue.VERSION) |
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
#!/bin/bash | |
# Parses JSON Web Tokens (https://en.wikipedia.org/wiki/JSON_Web_Token) | |
# and pretty-prints their content. | |
# | |
# © 2021 Daniel Lenski <dlenski@gmail.com>, MIT License | |
jq=$(which jq || echo cat) | |
for jwt in "$@"; do |
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 python3 | |
# Needs: Python 3.5+, Flask, PyCryptoDome | |
# server.pem, rsapubkey.pem + rsaprivkey.pem (1024-bit) in the current directory | |
# | |
# What it does: | |
# Pretends to be the "CT-KIP" web service (https://tools.ietf.org/html/rfc3948) that | |
# RSA SecurID Token for Windows v5.0.x talks to to set up a new token, using an | |
# authentication code. | |
# |
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
#!/bin/bash | |
# Based on: http://www.systutorials.com/5450/improving-sshscp-performance-by-choosing-ciphers/#comment-28725 | |
# | |
# You should set up PublicKey authentication so that you don't have to type your | |
# password for every cipher tested. | |
set -o pipefail | |
ciphers="$@" |
OlderNewer