Skip to content

Instantly share code, notes, and snippets.

View jerinisready's full-sized avatar
💭
A catalyst of Change

JK jerinisready

💭
A catalyst of Change
View GitHub Profile
@jerinisready
jerinisready / combined-lgpl-rules-from-gitlab.yml
Last active December 16, 2025 12:30
Please dont reuse, without actuall knowledge of license. This is not really recommedned for enterprices. I dont know which licenses these containse. This is just for Experimental purpose
rules:
- id: ruby_ftp_rule-AvoidTaintedFTPCall
mode: taint
pattern-sources:
- pattern: params
- pattern: cookies
- pattern: request.env
pattern-sinks:
- pattern-either:
- pattern: Net::FTP.$X(...)
@jerinisready
jerinisready / RPC.md
Created June 4, 2023 12:46
Demonstration and code reference for RPC in Python Demo for youtube shorts ( https://youtube.com/shorts/fBjxXnTES40 )

RPC in Python Demo

Simplest minimum code for demo - https://youtube.com/shorts/fBjxXnTES40 RPC in Python Concept

Here is the example of 2 implementations:

  • XMLRPC
  • JSONRPC

I am using python examples here; Do not misunderstand this. RPC's are available in every language. Just serarch for it in your favorite language

@jerinisready
jerinisready / django_model_to_csv.py
Created February 2, 2022 05:29
This gist shows an optimal way to convert data to csv from foreignkey connected models in Django. I dont have an analytics; but this is purely theoretical analysis.
import csv
from collections import defaultdict
from django.db.models import Prefetch
from django.utils.datetime_safe import datetime
class Property(models.Model):
# id = ... # primary key in model
pass
@jerinisready
jerinisready / django_oscar_load_from_wp.py
Created October 27, 2021 17:42
Load Default Wordpress Export data in csv format on to django oscar catalogue directly using this management script. This script might be buggy, but its a basic frammework you can relay for! modification welcomed!
import uuid
import psycopg2
from django.core.management import BaseCommand
import csv
from django.db import models, IntegrityError
from django.utils.text import slugify
import urllib3
import tensorflow as tf
import os
import numpy as np
import matplotlib.pyplot as plt
base_dir = "/Users/dhananjay.trivedi/Downloads/Train/"
"""
# Use `ImageDataGenerator` to rescale the images.
@jerinisready
jerinisready / Pattern Printing Breakdown lookaside triangles.md
Last active September 22, 2021 12:22
Pattern Printing Breakdown lookaside triangles.

PATTERN PRINTING

C                     G
C O                 N G
C O D             I N G
C O D I         D I N G
C O D I N     O D I N G
C O D I N G C O D I N G
C O D I N     O D I N G
C O D I D I N G
@jerinisready
jerinisready / Calculate the Electricty Bill - Question.md
Last active September 22, 2021 08:19
CALCULATE The Electricity Power Consumption Rate you your personal electricity board, from the number of units consumed this month.

ELECTRICTY BILL

CALCULATE The Electricity Power Consumption Rate you your personal electricity board, from the number of units consumed this month.

Charges are as follows:

Units of Consumption Charges / UNIT
1-100 Rs 0.20 / unit in this slot
101-200 Rs. 0.35 / unit in this slot

Print the following Pattern.

            *                   # 1
          0 1 0                 # 3
        0 0 1 0 0               # 5
    $ $ # # $ # # $ $           # 9
* * $ $ # # # # # $ $ * *       #13
    $ $ # # $ # # $ $  
        0 0 1 0 0 
 0 1 0 
@jerinisready
jerinisready / django_orm_oscar_postgres_filter_options.py
Created May 20, 2021 19:16
Djagno ORM Oscar Postgres Product listing filtering search and sort views in drf!
@api_view()
def filter_options(request, pk):
""" pass parameters to create dynamic filter in frontend! """
attrs = ProductAttribute.objects.filter(
is_varying=True, product_class__id=pk
).prefetch_related('productattributevalue_set')
return Response({
'results': [{
'code': attr.code,
'label': attr.name,
@jerinisready
jerinisready / schedule_games.py
Created April 20, 2021 08:21
Here is how to schedule games between different teams. This scripts considers each team into "Grade A" or "Grade B". Games between "Group A" teams will have "event_weightage_score" of 100, Games between "Group B" teams will have "event_weightage_score" of 60, Games between teams from "Group A" and "Group B" will have "event_weightage_score" of 8…
import itertools
from datetime import date, timedelta
class Team:
grade = None
name = None
def __init__(self, name, grade):
self.name = name