Skip to content

Instantly share code, notes, and snippets.

@Et7f3
Et7f3 / gist:922260074697e585bb492b5f2e7e1166
Last active August 27, 2024 18:13 — forked from simonw/gist:7000493
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
return "$dt$" + str(obj.isoformat())
return super().default(obj)
data = {
"name": "Silent Bob",
@Et7f3
Et7f3 / engine.py
Created March 18, 2024 19:50 — forked from klali/engine.py
sample for using a yubihsm2 with python requests
try:
from OpenSSL._util import (
ffi as _ffi,
lib as O,
lib as S
)
pyopenssl = True
import sys

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@Et7f3
Et7f3 / gradientAnimation.html
Last active November 23, 2017 07:22 — forked from anonymous/my.css
CSS Gradient Animation
<!DOCTYPE html>
<html>
<head>
<style>
/*an exemple for my friend
**voici un exemple d'animation*/
div
{
width: 100px;
height: 100px;