Skip to content

Instantly share code, notes, and snippets.

diff --git a/ckan/config/middleware/__init__.py b/ckan/config/middleware/__init__.py
index 73af42fa2..a958d8e42 100644
--- a/ckan/config/middleware/__init__.py
+++ b/ckan/config/middleware/__init__.py
@@ -127,8 +127,19 @@ class AskAppDispatcherMiddleware(object):
* CKAN_CURRENT_URL is set to the current application url
'''
+ # Ensure URL encoding
+ for var in ('PATH_INFO', 'REQUEST_URI', 'QUERY_STRING'):
@bzar
bzar / lib.rs
Created February 8, 2018 06:14
wasm-pong-rs
mod opengl;
mod data;
use opengl::*;
extern {
//fn consoleLog(x: u32);
fn playAudio(audio_ptr: *const f32, audio_len: u32);
fn setScore(left: u32, right: u32);
}
@bzar
bzar / slack-dump.js
Last active November 17, 2017 08:36
const token = process.env.SLACK_TOKEN
const Slack = require('slack')
const bot = new Slack({token})
const CHANNEL = process.argv[2];
const SINCE = process.argv[3];
const UNTIL = process.argv[4];
function toSlackTime(t) {
return new Date(t).getTime() / 1000.0;
snd-bcm2835
vc4
gpu_mem=256
dtoverlay=vc4-kms-v3d
lcd_rotate=2
Timer {
id: backlightTimer
interval: 1000*60*5
onTriggered: backlight.state = false
running: backlight.state
repeat: false
}
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QCursor>
#include "key_emitter.h"
#include "raspberrybacklight.h"
int main(int argc, char *argv[])
import QtQuick 2.0
Rectangle {
property color unpressedColor: "gray"
property color pressedColor: "lightgray"
property alias pressed: ma.pressed
property alias text: label.text
property real size: 1
signal clicked()
{reverse, sum, empty, all, fold, concat-map, flatten, span, Obj, sort-by, head} = require 'prelude-ls'
# [[String]] -> Bool
in-order = (xss) -> all (-> it.length == 1), xss
# [[String] -> Data -> [[String]]] -> Data -> [String] -> [[String]]
order-by-one = (fs, d, xs) -->
| xs.length < 2 => [xs]
| otherwise =>
fold ((ys, f) -> if ys.length == 1 then f(ys[0], d) else ys), [xs], fs
@bzar
bzar / deaddrop.md
Last active April 14, 2016 11:49
Dead drop imaginary messaging server spec

Rationale

A centralized messaging system that should impart as little information as possible to any third parties, including the server administrator. Any information accessible by the server administrator is considered public as far as user security is concerned.

The server should be practical and attempt to disencourage unwanted behaviour like spamming. It should also have access control to allow private servers, but not at the cost of revealing message senders.