Skip to content

Instantly share code, notes, and snippets.

View aegis1980's full-sized avatar

Jon Robinson aegis1980

View GitHub Profile
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@sandcastle
sandcastle / copy-to-clipboard.ts
Created July 17, 2017 06:38
A copy to clipboard function (in typescript)
export const copyToClipboard = (url: string) => {
document.addEventListener('copy', (e: ClipboardEvent) => {
e.clipboardData.setData('text/plain', url);
e.preventDefault();
document.removeEventListener('copy');
});
document.execCommand('copy');
};
@helo9
helo9 / xfoil.py
Last active November 26, 2023 02:53
use python to run xfoil analysis
# -*- coding: utf-8 -*-
import os
import numpy as np
import subprocess as sp
import re
def polar(afile, re, *args,**kwargs):
"""calculate airfoil polar and load results
@CurlyWurly-1
CurlyWurly-1 / sniffer_433_RX
Created May 13, 2017 13:22
A pair of Arduino UNO sketches to decrypt and spoof 433 MHz "static code" communication
/*
sketch : sniffer_433_RX (sister of "sniffer_433_TX")
Author : Peter Matthews (CurlyWurly) May 2017
Desc : When a static 433 transmission is received, a "int codez[]=.." line is output to the serial bus.
Copy this line and paste it into the the sister sketch "sniffer_433_TX"
INFORMATION
N.B. Connect pin 2 (rxpin) to the RX module output
N.B. Copy the output "int codez[] = ...." from serial bus and copy into the sister sketch "Sniffer_433_TX"
N.B. This sniffer sketch just outputs a set value of 35 in code[0]. This means that you may have to
experiment using a different "repeat" value (usually a value of 15 - 45) when used in the "TX" sketch
@pgjones
pgjones / app.py
Last active January 15, 2020 15:00
flask-sockets example requires: Flask, Flask-Sockets, Flask-SocketIO
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template_string
from flask_sockets import Sockets
import json
app = Flask(__name__)
sockets = Sockets(app)
template = """