Skip to content

Instantly share code, notes, and snippets.

View uds5501's full-sized avatar
🤷‍♂️
mhm

Uddeshya Singh uds5501

🤷‍♂️
mhm
View GitHub Profile
@uds5501
uds5501 / EXPLAIN.md
Last active January 6, 2024 20:56
mariadb EXPLAIN rough notes

5th Jan 2024

I will be updating this gist as I dig deeper into the optimization planner. My research will be strictily bound to SELECT qeury right now.

When running an explain query, you can find the output like ->

MariaDB [sample_db]> explain select * from sample_table;
+------+-------------+--------------+------+---------------+------+---------+------+------+-------+
| id   | select_type | table        | type | possible_keys | key  | key_len | ref  | rows | Extra |
+------+-------------+--------------+------+---------------+------+---------+------+------+-------+
@uds5501
uds5501 / docker-compose-gen.py
Last active June 3, 2023 08:26
Script for docker compose and redis sentinel config generation
import sys
REDIS_CONFIG_MASTER_NAME = "mymaster"
def generate_sentinels(num_pairs, num_sentinels):
docker_compose = ""
for i in range(1, num_sentinels + 1):
docker_compose += f" redis-sentinel-{i}:\n"
docker_compose += f" container_name: 'redis-sentinel-{i}'\n"
docker_compose += f" image: redis:6.0-alpine\n"
@uds5501
uds5501 / themepart3.js
Created May 6, 2020 18:06
adding new colours in the mix
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
import React, { useState } from "react";
import Switch from "@material-ui/core/Switch";
export default function Dashboard() {
const [darkState, setDarkState] = useState(false);
const palletType = darkState ? "dark" : "light";
const mainPrimaryColor = darkState ? orange[500] : lightBlue[500];
const mainSecondaryColor = darkState ? deepOrange[900] : deepPurple[500];
const darkTheme = createMuiTheme({
@uds5501
uds5501 / themestep2.js
Last active May 6, 2020 17:44
Theme switcher
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
import React, { useState } from "react";
import Switch from "@material-ui/core/Switch";
export default function Dashboard() {
const [darkState, setDarkState] = useState(false);
const palletType = darkState ? "dark" : "light";
const darkTheme = createMuiTheme({
palette: {
type: palletType,
@uds5501
uds5501 / themestep1.js
Created May 6, 2020 17:13
dark theme step1
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
import React, { useState } from "react";
export default function Dashboard() {
const [darkState, setDarkState] = useState(false);
const palletType = darkState ? "dark" : "light";
const darkTheme = createMuiTheme({
palette: {
type: palletType,
}
@uds5501
uds5501 / theme_pallet.js
Last active May 6, 2020 17:10
step 1 of dark theme
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
import React, { useState } from "react";
export default function Dashboard() {
const [darkState, setDarkState] = useState(false);
const palletType = darkState ? "dark" : "light";
const darkTheme = createMuiTheme({
palette: {
type: palletType,
}
@uds5501
uds5501 / GSoC19-work-product.md
Last active September 11, 2021 15:27
GSoC 2019 Work Product | Uddeshya Singh | Open Event Frontend & Server | FOSSASIA

Uddeshya Singh | @uds5501 | FOSSASIA

Overview:

In this summer period, I worked on FOSSASIA's Open Event projects (comprising of Open Event Server and Open Event Frontend). The Open Event , popularly know as Eventyay, is an open sourced event management platform which enables users to host conferences and various kinds of meet-ups and helps them customize their event according to their requirements. Sophisticated features like tickets, payment collections and call for speakers have been provided and can be further fine tuned into several tracks, venues and sessions.

My main goal of this period was to focus on making the Eventyay platform more stable for new users while laying down foundations for making the platform smoother in terms of payment gateway integrations and payment workflows.

@uds5501
uds5501 / apipermit.py
Last active April 25, 2019 03:27
api.haspermit decorator
from flask import Flask
from flask_rest_jsonapi import Api
from your_project.permission import permission_manager
app = Flask(__name__)
api = Api()
api.init_app(app)
api.permission_manager(permission_manager)
@uds5501
uds5501 / tax_api.py
Created April 25, 2019 02:58
api for taxes
from flask import request
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from flask_rest_jsonapi.exceptions import ObjectNotFound
from sqlalchemy.orm.exc import NoResultFound
from app.api.bootstrap import api
from app.api.helpers.db import get_count, safe_query
from app.api.helpers.exceptions import ForbiddenException, ConflictException, MethodNotAllowed
from app.api.helpers.permission_manager import has_access
from app.api.helpers.utilities import require_relationship
@uds5501
uds5501 / schema_tax.py
Created April 25, 2019 02:57
tax schema
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Relationship
from app.api.helpers.utilities import dasherize
from app.api.schema.base import SoftDeletionSchema
from utils.common import use_defaults
@use_defaults()
class TaxSchemaPublic(SoftDeletionSchema):