Skip to content

Instantly share code, notes, and snippets.

View trAve3113r's full-sized avatar

Arthur Mwai trAve3113r

  • East Africa,Kenya
View GitHub Profile
@gvangool
gvangool / daemonextension.py
Created July 13, 2009 13:51 — forked from screeley/daemonextension.py
Django Management Command for starting a daemon.
"""
Copyright (c) 2009, Sean Creeley
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@Atem18
Atem18 / gist:4696071
Last active April 19, 2024 11:18 — forked from evildmp/gist:3094281
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
<!DOCTYPE html>
<html lang="en"> <!-- Set this to the main language of your site -->
<head>
<meta charset="utf-8">
<title>HTML5</title>
<!-- Enter a brief description of your page -->
<meta name="description" content="">
<!-- Define a viewport to mobile devices to use - telling the browser to assume that the page is as wide as the device (width=device-width) and setting the initial page zoom level to be 1 (initial-scale=1.0) -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Add normalize.css which enables browsers to render all elements more consistently and in line with modern standards as it only targets particular styles that need normalizing -->
@sloria
sloria / bobp-python.md
Last active September 9, 2025 10:52
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@viveksoundrapandi
viveksoundrapandi / python django create and download zip
Created March 17, 2014 14:52
A simple snippet to zip files in a directory and send it the browser in downloadable format in django
from shutil import make_archive
from django.core.servers.basehttp import FileWrapper
def download(request,file_name=""):
"""
A django view to zip files in directory and send it as downloadable response to the browser.
Args:
@request: Django request object
@file_name: Name of the directory to be zipped
Returns:
A downloadable Http response
@martinrusev
martinrusev / cron_supervisord.ini
Last active May 6, 2025 09:49
Cron supervisord
[supervisord]
nodaemon=true
loglevel=debug
[program:amon]
command=gunicorn -c gunicorn.conf.py wsgi
directory=/amon
autostart=true
autorestart=true
redirect_stderr=true
@rjz
rjz / rabbitmq-monitor.sh
Created January 13, 2015 19:24
rabbitmq-queue-monitor
#!/bin/bash
#
# Use RabbitMQ admin plugin to monitor backed up queues. If `THRESHOLD` is
# exceeded, an error list will be served at 127.0.0.1:1334/overage.txt. If
# all queues are below the threshold, requests for the overage file should
# expect a 404.
# API host, user, and password
HOST=127.0.0.1:15672
USER=admin
@dklassen
dklassen / celery.sh
Last active March 25, 2017 17:58 — forked from amatellanes/celery.sh
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),

This is a crash course in JavaScript. It is intended for people who already have a bit of programming experience in other languages.

This will hopefully give a basic idea of the most-commonly-used language features, but it is not indended to be a comprehensive guide.

This guide was last updated in August 2016.

Basic syntax

To declare a variable called foo:

@M-Bryant
M-Bryant / monotonic.py
Created December 14, 2016 00:53
Set of python functions for checking list of number increasing
def strictly_increasing(L):
"""Returns TRUE if the values in the list are strictly increasing
Always increasing; never remaining constant or decreasing or null.
"""
return all(x<y for x, y in zip(L, L[1:]))
def strictly_decreasing(L):
"""Returns TRUE if the values in the list are strictly decreasing
Always decreasing; never remaining constant or increasing or null.