Skip to content

Instantly share code, notes, and snippets.

@tecoholic
tecoholic / 01-11-2020.txt
Last active Nov 25, 2020
CovidBulletinExtractor.ipynb
View 01-11-2020.txt
COVID-19 Positive Deaths without comorbidities – Total: 2
Death in Private health facilities without comorbidities
Death Case No. 11133
A 58 Years old Male from Vellore having COVID-19 RTPCR Positivity on
29.10.2020 admitted on 18.10.2020 at 09.32 AM in a private medical college
and hospital, Vellore with Complaints of Fever, Cough for 5 days and
Difficulty in Breathing for 2 days died on 29.10.2020 at 04.30 AM due to
ARDS / COVID-19 Pneumonia.
Death in Government health facilities (DMS) without comorbidities
Death Case No. 11134
@tecoholic
tecoholic / category.js
Created Aug 11, 2020
Strapi Controller file implementing the IsOwner Policy
View category.js
'use strict';
const { parseMultipartData, sanitizeEntity } = require("strapi-utils");
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/
module.exports = {
@tecoholic
tecoholic / index.html
Last active Apr 1, 2020
D3 example with Covid API
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>D3.js Example</title>
<style>
.axis text {
font: 8px sans-serif;
}
/* This is the small lines in the axis */
@tecoholic
tecoholic / lamda_function.py
Last active Nov 12, 2019
Post Nifty movers to Mastodon
View lamda_function.py
"""A Mastodon bot that collects the Nifty data and creates a post"""
import json
import urllib.request
import urllib.parse
import os
from datetime import datetime
@tecoholic
tecoholic / app.py
Last active Aug 16, 2019
Example code for the post "Parsing & Validating JSON in Flask Requests"
View app.py
from flask import Flask, request, jsonify
from functools import wraps
app = Flask(__name__)
users = []
def required_params(required):
def decorator(fn):
@tecoholic
tecoholic / wireshark_http_extractor.py
Created Feb 6, 2019
Extract the flow of requests and responses from a Wireshark dump JSON exported file
View wireshark_http_extractor.py
import sys
import json
from urllib.parse import urlparse, parse_qs
def parse_multimap(ordered_pairs):
"""JSON loads object_pairs_hook, which creates a list of values when
duplicate keys are found in the JSON file being parsed
@tecoholic
tecoholic / process.py
Last active Feb 6, 2019
Python script to replace an image file in the PDF
View process.py
import sys
import os
from PIL import Image
# Include the \n to ensure extact match and avoid partials from 111, 211...
OBJECT_ID = "\n11 0 obj"
def replace_image(filepath, new_image):
@tecoholic
tecoholic / tiny_projects.md
Last active Jan 17, 2019
List of tiny projects to learn and showcase
View tiny_projects.md

1. Metro

Realtims OS metrics dashboard

Topics covered

  1. Ansynchronous Communication
  2. Server side push
  3. Websockets

2. Student Score Graph

A graph generator for the marks of students from CSV files

Topics covered

@tecoholic
tecoholic / Sample_input.txt
Last active Feb 7, 2018
Flash Card Generator - Python LaTeX
View Sample_input.txt
Question 1
Answer 1
Question 2
Answer 2
View celery.diff
diff --git a/clusterapp.py b/clusterapp.py
index 46d85d1..685b482 100644
--- a/clusterapp.py
+++ b/clusterapp.py
@@ -4,9 +4,6 @@ from clustermgr.application import create_app, init_celery
from clustermgr.extensions import celery
from flask.cli import FlaskGroup
-app = create_app()
-init_celery(app, celery)