This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\set ON_ERROR_ROLLBACK interactive | |
\timing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import jsonify, Response | |
class JSONResponse(Response): | |
@classmethod | |
def force_type(cls, value, environ=None): | |
if isinstance(value, dict): | |
value = jsonify(value) | |
return super().force_type(value, environ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
commit_timestamp=$(date -d @$(git log -n1 --format="%at") +%Y%m%d%H%M) | |
now=$(date +%s) | |
difference=($now - $commit_timestamp) | |
max=$((30 * 60)) | |
if [ "$difference" -lt "$max" ] | |
then | |
echo "Too soon" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
RUN apt-get update && apt-get install -y \ | |
python3 python3-dev \ | |
python3-pip \ | |
python3-virtualenv | |
RUN python3 -m virtualenv --python=python3 /ve | |
ENV PATH=/ve/bin:${PATH} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from flask.testing import FlaskClient | |
from flask.wrappers import Response | |
class JSONResponseWrapper(Response): | |
"""Extends the BaseResponse to add a get_json method. | |
This should be used as the response wrapper in the TestClient. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import requests | |
log = logging.getLogger(__name__) | |
# Currency without decimal places according to Neteller | |
NETELLER_NOT_DECIMAL = ['HUF', 'JPY'] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from geventwebsocket.handler import WebSocketHandler | |
from gevent.pywsgi import WSGIServer | |
from flask import Flask, request, render_template_string | |
from flask_sockets import Sockets | |
import json | |
app = Flask(__name__) | |
sockets = Sockets(app) | |
template = """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Value(object): | |
def __init__(self, a, b, c): | |
self.a = a | |
self.b = b | |
self.c = c | |
array = [] | |
for index in range(0, 360): | |
value = Value(10 * index, 20, 30) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ******************************************************************** | |
// * License and Disclaimer * | |
// * * | |
// * The Geant4 software is copyright of the Copyright Holders of * | |
// * the Geant4 Collaboration. It is provided under the terms and * | |
// * conditions of the Geant4 Software License, included in the file * | |
// * LICENSE and available at http://cern.ch/geant4/license . These * | |
// * include a list of copyright holders. * | |
// * * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To run this open ROOT and do | |
// .L PlotCAEN.cc+ | |
// PlotCAEN( "output_filename.root", 10 ); | |
// where the number is the event id you'd like to view the waveforms of | |
#include <RAT/DU/DSReader.hh> | |
#include <RAT/DS/Entry.hh> | |
#include <RAT/DS/Digitiser.hh> | |
#include <TCanvas.h> | |
#include <TGraph.h> |