Skip to content

Instantly share code, notes, and snippets.

@FBosler
FBosler / retry.py
Last active March 19, 2022 23:50
retry.py
#Copyright 2021 Fabian Bosler
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
@FBosler
FBosler / covid19.py
Created March 15, 2020 19:24
covid-visualization
import dash
import os
import plotly.express as px
import pandas as pd
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import json
from urllib.request import urlopen
from dash.dependencies import Input, Output
@FBosler
FBosler / auth.js
Last active March 10, 2020 08:25
backend_ii_iii
const express = require("express");
const router = express.Router();
const passport = require("passport");
const config = require("../config/config");
const providerScopes = {
google: { scope: ["profile", "email"] },
facebook: { scope: ["email"] },
amazon: { scope: ["profile"] },
github: {},
@FBosler
FBosler / asyncio.py
Last active September 1, 2022 20:40
ThreadPool
from datetime import datetime
import aiohttp
import asyncio
URL = "https://medium.fabianbosler.de/run"
async def sample_asyncio(samples):
start = datetime.now()
@FBosler
FBosler / code.py
Created February 21, 2020 18:43
functools.py
from functools import lru_cache
from datetime import datetime
@lru_cache(maxsize=None)
def fib_cache(n):
if n < 2:
return n
return fib_cache(n-1) + fib_cache(n-2)
def fib_no_cache(n):
@FBosler
FBosler / SignupLoginModal.js
Last active January 19, 2023 11:19
Backend
import React, { useState } from "react";
import { Modal, Form, Col, Row } from "react-bootstrap";
import axios from "axios";
import DelegatedAuthList from "../DelegatedAuthList";
import {
PaddedContainer,
EmailSymbol,
PasswordSymbol,
ResponsiveHeader4,
@FBosler
FBosler / styles.js
Created February 10, 2020 06:48
Footer/styles.js
import { Navbar } from "react-bootstrap";
import styled from "styled-components";
export const StyledFooter = styled(Navbar)`
background-color: white;
-webkit-box-shadow: 0 24px 38px 3px #f7f7f72e, 0 9px 46px 8px #ffffff2b, 0 11px 15px -7px #ffffff45;
box-shadow: 0 24px 38px 3px #f7f7f72e, 0 9px 46px 8px #ffffff2b, 0 11px 15px -7px #ffffff45;
border-top: 2px solid #114b74;
`;
@FBosler
FBosler / index.jsx
Created February 10, 2020 06:48
Footer/index.jsx
import React from "react";
import { Link } from "react-router-dom";
import { StyledFooter } from "./styles";
const Footer = () => {
return (
<StyledFooter sticky="bottom">
<div style={{ float: "left" }}>© 2020 Copyright: Fabian Bosler</div>
<div style={{ float: "right", marginLeft: "auto" }}>
<Link to="/about">About</Link> <Link to="/about">Impressum</Link>
@FBosler
FBosler / app_v3.js
Created February 9, 2020 18:32
App_v3.js
import React from "react";
import { BrowserRouter as Router, Route } from "react-router-dom";
import Landing from "./components/layout/Landing";
import About from "./components/layout/About";
import Profile from "./components/layout/Profile";
import Nav from "./components/layout/Nav";
import "bootstrap/dist/css/bootstrap.min.css";
const App = () => {
@FBosler
FBosler / styles.js
Created February 9, 2020 18:29
Nav/styles.js
import { Navbar } from "react-bootstrap";
import styled from "styled-components";
export const StyledNav = styled(Navbar)`
background-color: white;
-webkit-box-shadow: 0 24px 38px 3px #f7f7f72e, 0 9px 46px 8px #ffffff2b, 0 11px 15px -7px #ffffff45;
box-shadow: 0 24px 38px 3px #f7f7f72e, 0 9px 46px 8px #ffffff2b, 0 11px 15px -7px #ffffff45;
border-bottom: 2px solid lightgrey;
`;