This file contains 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
""" | |
Copyright (c) <year> <copyright holders> | |
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: |
This file contains 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 | |
#This script will compile and install a static ffmpeg build with support for nvenc un ubuntu. | |
#See the prefix path and compile options if edits are needed to suit your needs. | |
echo "you must manually install your nvidia drivers first" | |
read -p "Press any key if you have done that..." | |
echo "and you must install cuda manually (if you already installed drivers, deselect 'install drivers' from cuda install):" | |
echo "wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run" | |
echo "sudo sh cuda_10.1.243_418.87.00_linux.run" |
This file contains 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
int size; | |
size = channels * width * height * sizeof(char); | |
unsigned char *image = NULL; | |
image = (unsigned char *) malloc(size); | |
// fill with gray | |
memset(image, 96, size); | |
This file contains 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, useEffect, createContext, useContext} from "react"; | |
import debug from 'debug'; | |
import URI from "urijs"; | |
import get from 'lodash.get'; | |
import {StateContextAjaxRequestCache, ProviderAjaxRequestCache} from "./StateContextAjaxRequestCache"; | |
import _ from "lodash"; | |
const log = debug('DjangoRenderFormContext'); | |
export const DjangoRenderFormContext = createContext(); |
This file contains 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, useEffect, useContext} from 'react'; | |
import {StateContextApplication} from "./StateContextApplication"; | |
let booleanAttributes = [ | |
"allowfullscreen", | |
"allowpaymentrequest", | |
"async", | |
"autofocus", | |
"autoplay", | |
"checked", |
This file contains 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
HOW TO Copy EC2 instance to Amazon Lightsail | |
WARNING - this is a guide to remind myself how to do it!!!! | |
WARNING - I'M NOT RESPONSIBLE FOR ANYTHING YOU DO WITH THIS! | |
WARNING - DON'T ASK ME ANY QUESTIONS ABOUT IT. | |
WARNING - THIS IS NOT A TUTORIAL - I'm typing this from memory. | |
These steps are a good approximation of what is needed but you'll | |
need strong tech skills to do this. Don't do it unless you know what you are doing. |
This file contains 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
# USE AT YOUR OWN RISK | |
# THIS IS FOR EXPERTS ONLY - KNOW WHAT YOU ARE DOING. | |
#Step 1: | |
Make sure old system and new system are running same OS | |
On both systems: | |
apt update | |
apt upgrade | |
#Step 2: |
This file contains 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
/* | |
// how to find out what is causing renders | |
const renderCount = useRef<number>(0) | |
const prev_getStateMachineNewState = useRef<any>() | |
const prev_getAjaxRequestCache = useRef<any>() | |
const prev_getApplicationState = useRef<any>() | |
const prev_getFormErrorData = useRef<any>() | |
log(`getFormErrorData ${(prev_getFormErrorData.current !== getFormErrorData) ? "changed" : "not changed"}`) | |
log(`getAjaxRequestCache ${(prev_getAjaxRequestCache.current !== getAjaxRequestCache) ? "changed" : "not changed"}`) |
This file contains 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 from 'react' | |
type Props = { | |
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void; | |
color?: string; | |
hoverColor?: string; | |
width?: number; | |
height?: number; | |
} |
This file contains 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
#!/usr/bin/python3 | |
import atexit | |
# sudo apt install python3-gpiozero | |
import gpiozero | |
import math, sys, os, time | |
import subprocess | |
import time | |
from threading import Timer | |
from os import listdir | |
from os.path import isfile, join |