Skip to content

Instantly share code, notes, and snippets.

View wbond's full-sized avatar

Will Bond wbond

View GitHub Profile
@wbond
wbond / YAML.yaml
Last active February 27, 2023 13:43
%YAML 1.2
# The MIT License (MIT)
#
# Copyright (c) 2015 FichteFoll <fichtefoll2@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
@wbond
wbond / compile.sh
Last active September 21, 2022 22:39
Subversion windows compile
# Install mingw with msys and all options from http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/
# Install python 2.7 to C:\Python27 and add to Path environmental variable
cd ~/src
cd openssl
./Configure mingw shared --prefix=/usr/local
make depend
make
make install
@wbond
wbond / 50-cloud-init.yml
Last active March 3, 2021 08:33
RPi 4 Setup
# /etc/netplan/50-cloud-init.yml
network:
renderer: NetworkManager
ethernets:
eth0:
dhcp4: true
version: 2
@wbond
wbond / package_control.py
Last active August 14, 2020 18:42
How to monkey patch a Python module with code from another location
import importlib
import os
__pkg_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
'Packages',
'Package Control',
'package_control'
)
__file_path = os.path.join(__pkg_path, '__init__.py')

Completion Kinds

  • python: sublime.KIND_ID_AMBIGUOUS, .sublime-completions: "ambiguous"
  • python: sublime.KIND_ID_KEYWORD, .sublime-completions: "keyword"
  • python: sublime.KIND_ID_TYPE, .sublime-completions: "type"
  • python: sublime.KIND_ID_FUNCTION, .sublime-completions: "function"
  • python: sublime.KIND_ID_NAMESPACE, .sublime-completions: "namespace"
  • python: sublime.KIND_ID_NAVIGATION, .sublime-completions: "navigation"
  • python: sublime.KIND_ID_MARKUP, .sublime-completions: "markup"
  • python: sublime.KIND_ID_VARIABLE, .sublime-completions: "variable"
function repr(data, level)
if not level then
level = 1
end
local data_type = type(data)
if data_type == 'table' then
if level == nil then
level = 1
from Default.exec import ExecCommand
class MyFirstExecCommand(ExecCommand):
def finish(self, proc):
super().finish(proc)
errs = self.output_view.find_all_results()
if len(errs) == 0:
sublime.active_window().run_command('my_second_exec_command')
class MySecondExecCommand(ExecCommand):
from asn1crypto.csr import CertificationRequest
cr = CertificationRequest.load(der_bytes)
attrs = cr['certification_request_info']['attributes']
print(attrs.native)
if signed:
if value < 0:
bits_required = abs(value + 1).bit_length()
else:
bits_required = value.bit_length()
if bits_required % 8 == 0:
bits_required += 1
else:
bits_required = value.bit_length()
width = math.ceil(bits_required / 8) or 1
TrustedCertificate ::= SEQUENCE {
trust SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
reject [0] IMPLICIT SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
alias UTF8String OPTIONAL,
keyid OCTET STRING OPTIONAL,
other [1] IMPLICIT SEQUENCE OF AlgorithmIdentifier OPTIONAL
}