Skip to content

Instantly share code, notes, and snippets.

View lalatgithub's full-sized avatar
🏠
Working from home

Lal lalatgithub

🏠
Working from home
View GitHub Profile
{
"name": "User",
"fields": [
{
"name": "id",
"label": "id",
"type": "BigAutoField"
},
{
"name": "account",
Python RQ Celery
Purely based on Redis works with Redis Rabbitmq SQS and Zookeeper (experimental)
RQ does not use an advanced broker to do the message routing Celery does this thing very well
Does not speak a portable protocol since it depends on pickle to serialize the jobs so its a Python only system supports json yaml pickle msgpack which makes it able to produce task from any programming language
Workers can also be started in burst mode to finish all currently available work and quit as soon as all given queues are emptied Nothing similar in Celery
only run on systems that implement fork(). Each worker will process a single job at a time. Within a worker there is no concurrent processing going on. If you want to perform jobs concurrently simply start more workers (using supervisor or systemd) Celery works with fork gevent eventlet and solo and does auto scaling process within a single worker process
RQ need supervisor to scale up processes(workers) Celery has built-in option to auto scale processes
@lalatgithub
lalatgithub / names.txt
Created June 21, 2019 12:27
List of Names
Darth
Luke
Darth
Lea
Darth
Lea
Lea
Luke
Darth
Lea
@lalatgithub
lalatgithub / census.csv
Created August 13, 2018 11:59
Census Data CSV
We can't make this file beautiful and searchable because it's too large.
SUMLEV,REGION,DIVISION,STATE,COUNTY,STNAME,CTYNAME,CENSUS2010POP,ESTIMATESBASE2010,POPESTIMATE2010,POPESTIMATE2011,POPESTIMATE2012,POPESTIMATE2013,POPESTIMATE2014,POPESTIMATE2015,NPOPCHG_2010,NPOPCHG_2011,NPOPCHG_2012,NPOPCHG_2013,NPOPCHG_2014,NPOPCHG_2015,BIRTHS2010,BIRTHS2011,BIRTHS2012,BIRTHS2013,BIRTHS2014,BIRTHS2015,DEATHS2010,DEATHS2011,DEATHS2012,DEATHS2013,DEATHS2014,DEATHS2015,NATURALINC2010,NATURALINC2011,NATURALINC2012,NATURALINC2013,NATURALINC2014,NATURALINC2015,INTERNATIONALMIG2010,INTERNATIONALMIG2011,INTERNATIONALMIG2012,INTERNATIONALMIG2013,INTERNATIONALMIG2014,INTERNATIONALMIG2015,DOMESTICMIG2010,DOMESTICMIG2011,DOMESTICMIG2012,DOMESTICMIG2013,DOMESTICMIG2014,DOMESTICMIG2015,NETMIG2010,NETMIG2011,NETMIG2012,NETMIG2013,NETMIG2014,NETMIG2015,RESIDUAL2010,RESIDUAL2011,RESIDUAL2012,RESIDUAL2013,RESIDUAL2014,RESIDUAL2015,GQESTIMATESBASE2010,GQESTIMATES2010,GQESTIMATES2011,GQESTIMATES2012,GQESTIMATES2013,GQESTIMATES2014,GQESTIMATES2015,RBIRTH2011,RBIRTH2012,RBIRTH2013,RBIRTH2014,RBIRTH2015,RDEATH20
@lalatgithub
lalatgithub / olympics.csv
Created August 9, 2018 11:12
All-time Olympic Games medal CSV
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
№ Summer 01 ! 02 ! 03 ! Total № Winter 01 ! 02 ! 03 ! Total № Games 01 ! 02 ! 03 ! Combined total
Afghanistan (AFG) 13 0 0 2 2 0 0 0 0 0 13 0 0 2 2
Algeria (ALG) 12 5 2 8 15 3 0 0 0 0 15 5 2 8 15
Argentina (ARG) 23 18 24 28 70 18 0 0 0 0 41 18 24 28 70
Armenia (ARM) 5 1 2 9 12 6 0 0 0 0 11 1 2 9 12
Australasia (ANZ) [ANZ] 2 3 4 5 12 0 0 0 0 0 2 3 4 5 12
Australia (AUS) [AUS] [Z] 25 139 152 177 468 18 5 3 4 12 43 144 155 181 480
Austria (AUT) 26 18 33 35 86 22 59 78 81 218 48 77 111 116 304
Azerbaijan (AZE) 5 6 5 15 26 5 0 0 0 0 10 6 5 15 26
{
"id": "in_1CtAW6EJm399uiqN75nU7uDk",
"object": "invoice",
"amount_due": 210,
"amount_paid": 0,
"amount_remaining": 210,
"application_fee": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
html file(index.html)
{% extends 'base.html' %}
{% block content %}
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#image_Modal">Add Image</button>
# image create view
if form.is_valid():
images = Image.objects.order_by('-_id').all()
if len(images)>0:
# get latest image scene number
scene_number = Images.first().scene_number + 1
else:
# creating first image so set scene_number =1
scene_number = 1
# add this js file /static/js/image_edit.js
$(document).ready(function(){
var width = window.innerWidth;
var height = window.innerHeight;
function update(activeAnchor) {
var group = activeAnchor.getParent();
var topLeft = group.get('.topLeft')[0];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h1>Images</h1>
<table>
{% for image in object_list %}
<tr>