Skip to content

Instantly share code, notes, and snippets.

View dicagno's full-sized avatar

Alberto Di Cagno dicagno

View GitHub Profile

Yes, there are several commands you can try on macOS to reset USB drivers and reconnect devices without restarting:

Quick USB Reset Commands

1. Reset USB system (most effective):

sudo kextunload -b com.apple.driver.usb.AppleUSBEHCI
sudo kextload -b com.apple.driver.usb.AppleUSBEHCI
#!/bin/bash
npx lighthouse "${1}" --preset=experimental --screenEmulation.width=390 --screenEmulation.height=844 --screenEmulation.deviceScaleFactor=3 --screenEmulation.mobile=true --throttling.downloadThroughput=1600 --throttling.uploadThroughput=750 --throttling.rttMs=150 --throttling.cpuSlowdownMultiplier=6
import machine
import time
import usb_midi
import adafruit_midi
from adafruit_midi.control_change import ControlChange
from adafruit_ads1x15.analog_in import AnalogIn
from adafruit_ads1x15.ads1115 import ADS1115
from adafruit_bus_device.i2c_device import I2CDevice
# Initialize I2C for ADS1115
const gtmScripts = document.querySelectorAll('script[src*="googletagmanager.com"]');
const gtmScriptsArray = Array.from(gtmScripts).map((s) => ({src: s.src, code: s.innerHTML}));
console.log(gtmScriptsArray);

10 NASA/JPL Lab Rules for Safety-Critical Coding

  1. No goto, ban recursive operations
  2. All loops should have fixed bounds
  3. No dynamic memory allocation, only static
  4. Aim for a max 60 lines per function
  5. Minimum of two assertions per function
  6. Use the smallest scope for data (variable)
  7. Always check the return value of all functions, cast to (void) when no return value
  8. Limit the use of Preprocessor directives
import board
import rotaryio
import time
import digitalio
from board import *
import busio
import usb_midi
import adafruit_midi
import analogio
import neopixel
<b>Test</b>
<img src="https://avatars.githubusercontent.com/u/5924009?v=4" />
#!/usr/bin/env bash
kubeadm reset
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
@dicagno
dicagno / Resample.hpp
Created June 7, 2022 04:13 — forked from pixelpusher/Resample.hpp
Downsampling example for C++
/**
* Resampling algo from http://en.wikipedia.org/wiki/Lanczos_resampling
* Adapted by / copyright Evan Raskob <[email protected]>, 2009-2019
* Free to use with attribution to all original authors / MIT License
* https://opensource.org/licenses/MIT
*
* 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.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@dicagno
dicagno / ANSI.md
Created January 22, 2022 09:57 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27