Skip to content

Instantly share code, notes, and snippets.

Avatar

Anand Chitipothu anandology

View GitHub Profile
@anandology
anandology / api-v1.md
Last active Jun 9, 2021
API optioons for Joy
View api-v1.md

API - V1

Basic Types

Create a circle:

circle()
circle(r=50)
circle(cx=100, cy=100, r=50)
@anandology
anandology / test_email_queue.py
Created May 24, 2021
email test using py.test
View test_email_queue.py
def test_sendmail(monkeypatch):
emails = []
def mock_sendmail(self, from_addr, to_addrs, msg, mail_options=(), rcpt_options=()):
emails.append(dict(from_addr=from_addr, to_addrs=to_addrs, msg=msg))
monkeypatch.setattr(smtplib.SMTP, "sendmail", mock_sendmail)
frappe.sendmail(
@anandology
anandology / README.md
Created May 20, 2021
Minimal test to reproduce issue with new frappe build system
View README.md

This gist demonstrates one of the issues with the new build system of Frappe.

How to reproduce

Step 1

Add the sq.js and square.bundle.js from gist to apps/frappe/frappe/public/js in your bench.

Step 2

@anandology
anandology / notes.md
Last active Feb 7, 2021
Lineage OS installation
View notes.md
View grid.js
function grid() {
push();
noFill();
stroke(200);
for (var x=0; x<width; x+=50) {
line(x, 0, x, height);
}
for (var y=0; y<height; y+=50) {
line(0, y, width, y);
@anandology
anandology / cli.md
Last active Apr 3, 2020
Build a CLI application to list the number of covid19 cases and death in India.
View cli.md

Write a CLI application to list the number of covid19 cases and deaths in India.

You can use the following API for getting that data:

https://github.com/anandology/covid19

The required interface is:

$ python covid19.py cases 
STATE CONFIRMED ACTIVE DEATHS
@anandology
anandology / covid19-thehindu.json
Created Mar 25, 2020
The number of COVID19 cases extracted from thehindu.com
View covid19-thehindu.json
{
"india": {
"confirmed": 586,
"active": 534,
"deaths": 10,
"recovered": 42,
"indians": 543,
"foreigners": 43
},
"states": {
@anandology
anandology / custom.css
Created Feb 22, 2020
Custom CSS to optimize the notebook presentation in full-screen when zoomed in
View custom.css
/*
FILE: ~/.jupyter/custom/custom.css
Custom CSS to optimize the notebook presentation in full-screen when zoomed in.
*/
@media all and (max-width: 800px) {
.prompt {
display: none !important;
}
#header-container, #maintoolbar, #menubar {
@anandology
anandology / app_foo.py
Last active Feb 3, 2020
Lazily Load Python Modules
View app_foo.py
# import pandas as pd
from .heavy_modules import pandas as pd
# from google.cloud import bigquery
from .heavy_modules import google_cloud_bigquery as bigquery
def foo(path):
df = pd.read_csv(path)
...
View stong-weak-primes.py
"""Python is infinitely beautiful!
This program is a response to the post "Infinite work is less work" by
Damian Conway[1].
This program demonstrates how infinity can be handled elegantly in
Python!
THE PROBLEM:
Write a script to generate first 10 strong and weak prime numbers.