Skip to content

Instantly share code, notes, and snippets.

View AlexanderProd's full-sized avatar
⚛️
Fusing Hydrogen

Alexander Hörl AlexanderProd

⚛️
Fusing Hydrogen
View GitHub Profile
@AlexanderProd
AlexanderProd / super_resolution_with_chunks.py
Created March 19, 2023 08:22
Uses chunks to upsample an image which reduces the required memory, especially helpful with very memory intensive models like EDSR.
import cv2
import numpy as np
import time
# Load the input image
input_image = cv2.imread('example.jpg')
# Define the size of the chunks
chunk_size = (200, 200)
@AlexanderProd
AlexanderProd / useAsync.js
Created January 17, 2021 11:43
useAsync.js
import { useReducer, useRef, useEffect, useCallback } from 'react';
function reducer(state, action) {
switch (action.type) {
case 'PENDING':
return { ...state, status: 'pending' };
case 'SUCCESS':
return { ...state, status: 'success', value: action.value };
case 'ERROR':
return { ...state, status: 'error', error: action.error };
@AlexanderProd
AlexanderProd / useGreeting.js
Created September 19, 2019 14:06
custom React hook that returns the default greeting of your users language based on navigator.language
import { useState, useEffect } from 'react'
const dict = {
"af": "Goeie dag",
"sq": "Tungjatjeta",
"ar": "Ahlan bik",
"zh": "Nín hao",
"hr": "Zdravo",
"cs": "Nazdar",
"da": "Hallo",
@AlexanderProd
AlexanderProd / bot.py
Last active December 16, 2018 08:57
Script for InstaPy
# imports
from instapy import InstaPy
from instapy.util import smart_run
import json
import time
import schedule
# login credentials
insta_username = '*********'
insta_password = '*********'
@AlexanderProd
AlexanderProd / backblaze b2 backup script
Last active April 4, 2023 03:25 — forked from scottlinux/backblaze b2 backup script
Backup script for backblaze working with backlaze b2 command line tool
#!/usr/bin/env bash
#
# Backup selected directories to a Backblaze B2 bucket
#
# If youre encountering errors running the script you probably need Bash 4.0
#
# You need to login to your b2 account once with b2 authorize-account [<accountId>] [<applicationKey>] before running it.
#
# Example daily cron running script.sh in home directory:
# @daily /usr/local/bin/bash ~/script.sh