Skip to content

Instantly share code, notes, and snippets.

View jtwaleson's full-sized avatar

Jouke Waleson jtwaleson

View GitHub Profile
@jtwaleson
jtwaleson / annoted-to-death.py
Last active November 27, 2022 14:08
Other hints than type hints
@intent("API wrapper method to send a single message to a single slack channel")
@allowed_users(roles=[roles.ADMIN, roles.END_USER])
@data_protection(possible_pii="attr:message")
@side_effects(has_side_effect=side_effects.EXTERNAL_API)
@memory(should_use_kb=10)
@speed(should_run_in_ms=1000)
@tests([post_message_to_slack_ultra_large_message_should_fail, post_message_to_slack_should_succeed])
def post_message_to_slack(channel: SlackChannel, message: SlackMessage):
requests.post("https://api.slack.com", message)
for i in $(seq 10); do uuid v1; sleep 1; done
cfb84790-2dd7-11e9-bf24-d7119ae2d1f1
d05b6560-2dd7-11e9-b1ec-7741959a2db9
d0fc8760-2dd7-11e9-a109-a559ffed0b17
d19ebad0-2dd7-11e9-826c-91dfdee76140
d2411550-2dd7-11e9-80b6-8918b1061e5e
d2e348c0-2dd7-11e9-9611-1782751eac1c
d385a340-2dd7-11e9-b240-5d8c2d636711
d42872f0-2dd7-11e9-a307-f581cc850936
d4cbdee0-2dd7-11e9-b1d8-9d336aace739
@jtwaleson
jtwaleson / m2ee-crypt.sh
Last active December 8, 2017 13:06
m2ee-crypt
#!/bin/bash
set -e
# Use this script instead of m2ee directly
#
# It will dynamically create a sensitive configuration file in RAM which
# will be used by m2ee and will be removed directly afterwards
# Preparation: remove sensitive parts from the m2ee.yaml file and store them somewhere safely
# such as in HashiCorp Vault or an encrypted gpg file. You can keep the rest of the m2ee.yaml
@jtwaleson
jtwaleson / mendix-filedocument-s3-uploader.py
Created February 28, 2017 13:17
Upload Mendix FileDocuments from local file system to S3
#!/usr/bin/env python2
import os
import uuid
import subprocess
bucket = os.getenv('S3_BUCKET')
access_key = os.getenv('S3_ACCESS_KEY')
secret_key = os.getenv('S3_SECRET_KEY')
region = "eu-west-1"
@jtwaleson
jtwaleson / print-certs.go
Created January 17, 2016 13:30
Print checksums of certificates public key, entire certificate, subject field, issuer field
package main
import "crypto/sha1"
import "crypto/x509"
import "fmt"
import "encoding/pem"
import "os"
import "time"
import "bufio"
import "strings"
@jtwaleson
jtwaleson / fetch.go
Created January 17, 2016 12:08
Certificate fetcher in Go
package main
import "crypto/tls"
import "crypto/sha1"
import "crypto/x509"
import "fmt"
import "encoding/pem"
import "os"
import "time"
import "bufio"
@jtwaleson
jtwaleson / offline.html
Created December 30, 2014 11:18
Mendix example offline page
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/error_page/style.css">
<script src="/error_page/script.js"></script>
</head>
<body>
This application is currently offline.
</body>
</html>
@jtwaleson
jtwaleson / debugger_result
Created February 11, 2013 20:32
Debugger message B
{
"status": 0,
"result":
{
"session_token": "87a33786-c041-456a-a2c6-d5ef1663dfd3",
"runtime_version": "4.3.0",
"project_id": "12345678-90ab-cdef-1234-567890abcdef",
"paused_microflows":
[
{
@jtwaleson
jtwaleson / debugger_start_session
Created February 11, 2013 20:29
Debugger message A
{
"action": "start_session",
"params": {
"breakpoints": [
{
"microflow_name": "...",
"object_id": "...",
"condition": "..."
}, ...
]
Map<String,SortDirection> filteredMap = Maps.newHashMap();
for(Entry<String,SortDirection> entry : sort.entrySet())
{
AttributePath attributePath = parsePath(entityName, entry.getKey());
if(!attributePath.getAttribute().isVirtual())
filteredMap.put(entry.getKey(), entry.getValue());
}