Skip to content

Instantly share code, notes, and snippets.

View spoetnik's full-sized avatar

Martijn de Geus spoetnik

  • The Hague, the Netherlands
View GitHub Profile
#!/bin/bash
function jwt_decode(){
jq -R 'split(".") | .[1] | @base64d | fromjson' <<< "$1"
}
function remove_quotes(){
sed -e 's/^"//' -e 's/"$//' <<<"$1"
}
@spoetnik
spoetnik / form.php
Created April 17, 2018 19:17 — forked from jacmaes/form.php
Processwire: Front-end upload form example using ProcessWire Inputfields #pw
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
@spoetnik
spoetnik / gist:046c2e9dd4242d2603ad
Created April 21, 2015 18:14
RABO MT940 Structured
:940:
:20:940S150202
:25:NL68RABO0123456789 EUR
:28C:0
:60F:C150130EUR000000005442,89
:62F:C150202EUR000000005442,89
:20:940S150203
:25:NL68RABO0123456789 EUR
:28C:0
:60F:C150202EUR000000005442,89
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# Use it in your models like this;
# validate_file = FileValidator(max_size=24*1024*1024,
# allowed_mimetypes=('text/plain',))
# file = models.FileField(upload_to='path_below_media/%Y/%m/%d', validators=[validate_file])