Skip to content

Instantly share code, notes, and snippets.

View trAve3113r's full-sized avatar

Arthur Mwai trAve3113r

  • East Africa,Kenya
View GitHub Profile
import requests
from bs4 import BeautifulSoup
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}
login_data = {
'name': '<username>',
'pass': '<password>',
#!/usr/bin/env python
# coding=utf-8
import json
import threading
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
from twisted.internet import reactor, ssl
@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.

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:

@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.#'),
@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
@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
@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
@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
<!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 -->