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 / 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 / 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 / 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 / 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 / aoc_d1_p1.py
Last active December 10, 2024 19:16
AOC day 10 P1&p2
visited_trail_heads = {}
starters = []
grid = []
for line in open('input10.txt'):
grid.append(line)
n = len(grid)
for i in range(n):
for j in range(n):
@uds5501
uds5501 / aoc_d13_p1.py
Created December 18, 2024 11:15
AOC D13 P1,2
import numpy as np
tasks = []
def get_num(x):
x = x.strip()
return int(x[2:])
with open('input13.txt') as file: