Skip to content

Instantly share code, notes, and snippets.

@benhowes
benhowes / info.md
Last active March 22, 2021 12:49
Simple JWT decoder

Gets a JS object which contains the decoded body of the JWT. For now I am pasting this in to postman tests when I need to get JWT decoding

#Important Does not validate the token at all!

# Minimal reproduction of
# "the [include_in_root] parameter can't be updated on a nested object mapping"
# When that error would not be expected
#
# Seems to happen with `settings.index.number_of_shards` > 1
#
# Tested against Elasticsearch 7.9.2
ES_HOST=localhost:19200

Example unit

def _parse_id(uid)
    if not instanceof(uid, UUID):
        uid = UUID(uid)
    return uid
# Unittest style, written for easy port
def test_boolean_validator(self):
variations = (
('False', 'err'),
('True', 'err'),
(0, 'err'),
(1, 'err'),
(True, True),
(False, False),

Keybase proof

I hereby claim:

  • I am benhowes on github.
  • I am benhowes (https://keybase.io/benhowes) on keybase.
  • I have a public key whose fingerprint is BD4B 0BB8 0437 A7BA AF41 530F 7047 FE88 C4ED F6D2

To claim this, I am signing this object:

@benhowes
benhowes / all_in_one.py
Created March 25, 2017 09:45
Snippets for mongoengine upgrade blog post
from mongoengine import *
class UpdatableDocument(Document):
schema_version = IntField(default=0)
schema_updates = {} # Dictionary to hold all the updates
def __init__(self, *args, **kwargs):
values = self.schema_update(kwargs)
@benhowes
benhowes / Processor info.txt
Created October 26, 2016 09:41
buildy mc-build-face
processor : 15
vendor_id : GenuineIntel
cpu family : 6
model : 26
model name : Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
stepping : 5
microcode : 0x19
cpu MHz : 1596.000
cache size : 8192 KB
physical id : 1
@benhowes
benhowes / rc-slider.scss
Created March 23, 2016 15:24
SCSS version of the LESS styles
$prefixClass: rc-slider;
$disabledColor: #ccc;
$border-radius-base: 6px;
$primary-color: #2db7f5;
$tooltip-color: #fff;
$tooltip-bg: tint(#666, 4%);
$tooltip-arrow-width: 4px;
$tooltip-distance: $tooltip-arrow-width+4;
$tooltip-arrow-color: $tooltip-bg;
DEBUG:root:UNKNOWN PTP Property d105 changed
DEBUG:root:UNKNOWN PTP Property d108 changed
DEBUG:root:UNKNOWN PTP Property d106 changed
DEBUG:root:UNKNOWN PTP Property d107 changed
DEBUG:root:UNKNOWN PTP Property d109 changed
$ dpkg --list | grep boost-thread
ii libboost-thread-dev 1.49.0.1 amd64 portable C++ multi-threading (default version)
ii libboost-thread1.42.0 1.42.0-4ubuntu2 amd64 portable C++ multi-threading
rc libboost-thread1.46.1 1.46.1-7ubuntu3 amd64 portable C++ multi-threading
ii libboost-thread1.49-dev 1.49.0-3.1ubuntu1.1 amd64 portable C++ multi-threading
ii libboost-thread1.49.0 1.49.0-3.1ubuntu1.1 amd64 portable C++ multi-threading
ben@ben-desktop:~$ dpkg --list | grep boost
ii libboost-all-dev 1.49.0.1 amd64 Boost C++ Libraries development files (ALL) (defaul