This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| # ECHO COMMAND | |
| # echo Hello World! | |
| # VARIABLES | |
| # Uppercase by convention | |
| # Letters, numbers, underscores | |
| NAME="Bob" | |
| # echo "My name is $NAME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), | |
| }, | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
NewerOlder