Skip to content

Instantly share code, notes, and snippets.

View inactivist's full-sized avatar
💭
fixing things

Michael Curry inactivist

💭
fixing things
View GitHub Profile
@adduc
adduc / install.sh
Last active August 24, 2021 09:23
My installation of mercurial, tortoisehg, and hg-git on Ubuntu 20.04 and newer
#!/bin/bash
TARGET_DIR=/opt/repos/third-parties
HG_GIT_VERSION=${1:-default}
HG_RELEASE_VERSION=${2:-5.5.2}
HG_REPO_VERSION=${3:-stable}
TORTOISEHG_VERSION=${4:-stable}
update() {
# Update packages
@rengler33
rengler33 / scrape_with_logs.py
Last active June 1, 2024 00:23
How to Capture Network Traffic When Scraping with Selenium & Python
# see rkengler.com for related blog post
# https://www.rkengler.com/how-to-capture-network-traffic-when-scraping-with-selenium-and-python/
import json
import pprint
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
capabilities = DesiredCapabilities.CHROME
@sonicprod
sonicprod / RPi4.MAME.Appliance.md
Last active May 17, 2024 17:26
How to make a dedicated MAME Appliance on a Raspberry Pi 4B | Comment réaliser un système MAME dédié sur un Raspberry Pi 4/Pi 400

How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400

Note: the following steps are written in French. Feel free to translate to English.

However, please take notice that if you copy the scripts on this page from the version translated into English by Google Translate, it is possible that extra characters may appear within some scripts (this is caused by Google Translate), resulting in corruption of the impacted scripts. Consequently, it is better to copy the scripts from the original French version of this page.

Comment réaliser un système MAME dédié sur un Raspberry Pi 4/Pi 400

@coryhouse
coryhouse / PromptOnUnload.jsx
Last active January 7, 2022 11:53
Prompt user when they navigate away
import React, { useEffect } from "react";
import PropTypes from "prop-types";
import { Prompt } from "react-router-dom";
// Prompt the user onbeforeunload or when navigating away by clicking a link
export default function PromptOnUnload({ when, message }) {
const enabled = when;
useEffect(() => {
if (!enabled) return;
const handleBeforeUnload = (event) => {
@thenishchalraj
thenishchalraj / ReactSampleGrafanaComponent.js
Last active March 21, 2023 13:05
Dynamically embedding Grafana Dashboards and panels. (code snippet)
import React from 'react'
//configuration file that has the values stored for users
import config from './config'
class SampleDashboard extends React.Component {
render() {
//suppose user is received from props
const { user } = this.props
return (
@richard-savant
richard-savant / pytest_flask_fixtures.py
Created March 27, 2020 20:36 — forked from qodot/pytest_flask_fixtures.py
Pytest Fixtures (Flask, SQLAlchemy, Alembic)
import sys
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from alembic.command import upgrade as alembic_upgrade
from alembic.config import Config as AlembicConfig
from wsgi import create_app
from config import config
@inactivist
inactivist / luigi_first_steps.md
Last active July 13, 2023 09:12 — forked from tomsing1/luigi_first_steps.md
First steps with the Luigi workflow manager

First steps with the Luigi workflow manager

As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.

The problems and solutions described in the examples below have led to the development of sciluigi,

@screeny05
screeny05 / index.ts
Last active October 21, 2021 19:16
Native File System Typescript Typings – https://wicg.github.io/native-file-system/
declare global {
enum ChooseFileSystemEntriesType {
'open-file',
'save-file',
'open-directory'
}
interface ChooseFileSystemEntriesOptionsAccepts {
description?: string;
mimeTypes?: string;
@ld-web
ld-web / useIsMounted.js
Created December 25, 2019 11:12
useIsMounted custom React hook
import React, { useEffect } from 'react';
/**
* useIsMounted hook can be used to check if a component is still mounted.
* Then, one can prevent a state update on an unmounted component, and therefore avoid memory leaks
*/
function useIsMounted() {
const isMounted = React.useRef(true);
useEffect(() => {
@frank-dspeed
frank-dspeed / 2018-https-localhost.md
Last active December 19, 2023 07:20 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

Create a own domain (1-10 Domains No Wildcards)

edit /etc/hosts add my.