Skip to content

Instantly share code, notes, and snippets.

View dylanbstorey's full-sized avatar

Dylan Storey dylanbstorey

View GitHub Profile
@pcostesi
pcostesi / example.py
Created August 15, 2012 03:43
Flask view decorator to dispatch a request into different handlers by mimetypes.
@split
@login_required
def hello():
return render_template('hello.html')
@hello.for_mimetype("application/json")
@login_required
def hello():
return jsonify({"hello":"flask"})
@d0c-s4vage
d0c-s4vage / autopypi.py
Created March 13, 2016 13:32
A simple script to auto-install packages from pypi when they are imported.
#!/usr/bin/env python
# encoding: utf-8
import imp
import os
import pdb
import pip
import readline
from pip.commands.search import SearchCommand
import sys
@criccomini
criccomini / run-tests.sh
Created June 22, 2016 15:16
run-tests.sh
#!/bin/bash
# Runs airflow-dags tests.
# Set Nose defaults if no arguments are passed from CLI.
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
NOSE_ARGS=$@
if [ -z "$NOSE_ARGS" ]; then
NOSE_ARGS=" \
--with-coverage \
@mathias-brandewinder
mathias-brandewinder / MDL.fs
Last active November 20, 2019 13:59
Recursive minimal entropy partitioning, based on Fayyad & Irani: break a continuous variable into discrete intervals top-down, maximizing the entropy gained at each step, with a stopping rule using the Minimum Description Length principle.
namespace Discretization
// Recursive minimal entropy partitioning,
// based on Fayyad & Irani 1993.
// See the following article, section 3.3,
// for a description of the algorithm:
// http://www.math.unipd.it/~dulli/corso04/disc.pdf
// Note: this can certainly be optimized.
module MDL =
@nuria
nuria / celery_before_after.py
Last active October 22, 2021 21:19
Handlers that execute right before and right after a task is executed in celery.
from celery import Celery
from celery.signals import after_task_publish,task_success,task_prerun,task_postrun
# first argument, current module
app = Celery('tasks')
app.config_from_object('celeryconfig')
# To instantiate celery and import this module
# do: celery -A task worker --loglevel=info
# after, once celery is running, instantiate a python console:
@josepjaume
josepjaume / docker-compose.yml
Created August 19, 2016 13:15
Docker Compose for Rust
rust-server:
image: didstopia/rust-server
restart: always
mem_limit: 15g
ports:
- "28015:28015"
- "28015:28015/udp"
- "28016:28016"
- "80:8080"
volumes:
@criccomini
criccomini / test_dags.py
Created June 22, 2016 15:18
test_dags.py
import os
import unittest
from airflow.models import DagBag
class TestDags(unittest.TestCase):
"""
Generic tests that all DAGs in the repository should be able to pass.
"""
@yoavram
yoavram / client.py
Created December 21, 2012 08:41
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
@vitorreus
vitorreus / create-cluster.sh
Created January 10, 2018 12:12
High Availability Redis cluster using Sentinel deployed in Docker Swarm
#!/bin/bash
#This script creates 1 master, 2 slaves and 3 sentinels services in docker swarm.
docker network create \
--driver overlay \
testes_network
SWARM_MASTER=192.168.205.125
#Master
@jannegpriv
jannegpriv / installation_steps_k3s_dashboard.md
Last active May 4, 2024 11:43
Installation steps for K3s dashboard.

Installation steps for K3s dashboard

The steps below requires that you have followed the installation steps for installing K3s on RPIs.

NOTE: The following files can be found in the following repository.

Installation steps for K3s dashboard. On master node, create a folder called dashboard: