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
import java.math.BigInteger; | |
import java.security.KeyFactory; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.spec.RSAPublicKeySpec; | |
import java.util.Base64; | |
public class MakePublicKey { | |
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeySpecException { |
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
# require cryptography and asn1crypto | |
import base64 | |
import os | |
from asn1crypto.keys import PrivateKeyInfo | |
from asn1crypto.pkcs12 import Pfx, SafeContents | |
from cryptography.hazmat.primitives.hashes import SHA256 | |
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC | |
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes |
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
nmap <C-S-+> :call ZoomIn()<cr> | |
nmap <C-_> :call ZoomOut()<cr> | |
function! ZoomIn() | |
let font_name=&guifont | |
let font_parts=split(font_name) | |
if len(font_parts) > 1 | |
let font_size=str2nr(font_parts[1]) | |
if font_size!=0 && font_size<64 | |
let font_name=font_parts[0] . " " . (font_size + 2) |
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
import string | |
from io import StringIO | |
__all__ = ['parse_dn', 'dn_to_string'] | |
class _Peekable: | |
def __init__(self, wrapped): | |
self.wrapped = wrapped | |
self.last_char = None |
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/python3 | |
# Note: use wpctl set-default <number> to use this information | |
from subprocess import check_output | |
import os | |
import re | |
import sys | |
''' | |
pw-cli ls | awk '/^\s*id/{ id=$2; sub(",", "", id) }/\s*node.description/{ name=substr($0, index($0, "=")+2); gsub("\"", "", name) } /\s*media.class.*Audio.Sink/ { print( id " " name ) }' | |
echo | |
echo use wpctl set-default NUMBER to use this information |
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
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: ubuntu | |
labels: | |
app: ubuntu | |
spec: | |
containers: | |
- image: ubuntu |
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
/* | |
* Need to install APR and HTTPD source | |
* https://github.com/apache/apr | |
* https://github.com/apache/httpd | |
* Build with `apxs -c -a mod_metrics.c` | |
* Install with: | |
* `sudo /PATH/TO/libtool --mode=install install mod_metrics.la /PATH/TO/modules/` | |
*/ | |
#include "httpd.h" | |
#include "http_core.h" |
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
class MySnapshot: | |
NO_ARGUMENT = object() | |
def __init__(self, expected_value=NO_ARGUMENT): | |
self.expected_value = expected_value | |
def __eq__(self, other): | |
if self.expected_value is self.NO_ARGUMENT: | |
from inspect import currentframe, getframeinfo | |
caller_frame = getframeinfo(currentframe().f_back) |
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
import sys | |
sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS]) | |
from pprint import pprint as pp | |
try: | |
import dotenv | |
dotenv.load_dotenv() | |
except ModuleNotFoundError: | |
pass | |
print('Python %s on %s' % (sys.version, sys.platform)) |
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
from pprint import pprint | |
import dataclasses | |
import struct | |
from datetime import datetime | |
import cryptography.x509 | |
from cryptography.x509 import Certificate | |
def next_long(f): | |
return struct.unpack(">Q", f.read(8))[0] |
NewerOlder