Skip to content

Instantly share code, notes, and snippets.

View Yankzy's full-sized avatar

Yankuba Kuyateh Yankzy

View GitHub Profile
@Yankzy
Yankzy / dict_merge.py
Created March 10, 2022 22:37 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
# Recursive dictionary merge
# Copyright (C) 2016 Paul Durivage <pauldurivage+github@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@Yankzy
Yankzy / user.py
Last active June 11, 2021 11:56
Django Global User Object
"""
SINGLETON PATTERN
I recently refactored my Django website into a GraphQL API and use react as frontend.
This was fun, but I lost some Django privileges most importantly "request.user".
This is my solution to restoring the privilege.
"""
class user:
__instance = None
@Yankzy
Yankzy / LoadSpinner.js
Created April 22, 2021 16:17
React Loading Spinner
import React, { useState } from "react";
import { makeStyles, Modal, CircularProgress } from "@material-ui/core";
const useStyles = makeStyles((theme) => ({
paper: {
position: "absolute",
padding: theme.spacing(2, 4, 3),
},
}));
@Yankzy
Yankzy / email_script.py
Last active December 25, 2021 23:04
Python script to monitor changes in files on your computer and send email to you using crontab.
import hashlib
import glob
import json
import smtplib
from email.message import EmailMessage
hasher = hashlib.md5()
size = 65536 #to read large files in chunks
list_of_files = glob.glob('./*.csv') #absolute path for crontab