Skip to content

Instantly share code, notes, and snippets.

todbot /
Last active Aug 19, 2022
use displayio to make simple bounch balls (CircuitPython, using a built-in display) video:
# - use displayio to make simple bounch balls
# 20 Jul 2021 - @todbot
import time, random
import board, displayio, terminalio
from adafruit_display_text import label
from import Circle
from adafruit_display_shapes.rect import Rect
display = board.DISPLAY # CP already sets up display for us, 240x135 for LILYGO T8 ESP32-S2
screen = displayio.Group() # a main group that holds everything
View reverse.rb
def reverse_str(str)
i =0
while i < str.length
reversed_string=str[i] + reversed_string # reverse
i +=1
mgrady3 /
Created Sep 24, 2017
Test Qt/PyQt Frameless Window resizing with QSizeGrip
Test Qt Frameless Window resizing with QSizeGrip
Maxwell Grady, September 2017.
import sys
from PyQt5 import QtCore, QtWidgets
from qtmodern.styles import dark
from import ModernWindow
ayufan /
Last active Aug 19, 2022
KVM CPU pinning for Proxmox VE
set -eo pipefail
cpu_tasks() {
expect <<EOF | sed -n 's/^.* CPU .*thread_id=\(.*\)$/\1/p' | tr -d '\r' || true
spawn qm monitor $VMID
expect ">"
MuhsinFatih /
Last active Aug 19, 2022
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
andersevenrud /
Last active Aug 19, 2022
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s >
fourgeotf / Autorisations sur bases SAGE.sql
Last active Aug 19, 2022
[Autorisations sur bases SAGE] Donner les autorisations sur une base sage #sql #sage
View Autorisations sur bases SAGE.sql
EXEC sp_change_users_login 'update_one','user_cbase','APPL_CBASE'
cilf / Dockerfile
Last active Aug 19, 2022
Adminer MongoDB docker image
View Dockerfile
FROM adminer:4.7.1
USER root
RUN apk add autoconf gcc g++ make libffi-dev openssl-dev
RUN pecl install mongodb
RUN echo "" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
customcommander / browser_logs-chrome.js
Created May 25, 2017
Capture console.log() output from a web page with Selenium WebDriver 2.53 and Chrome
View browser_logs-chrome.js
const path = require('path');
const wd = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
var builder = new wd.Builder();
var options = new chrome.Options();
var prefs = new wd.logging.Preferences();
var driver;
gustawho /
Last active Aug 19, 2022
Guía de Instalación de Arch Linux

Guía de Instalación de Arch Linux

El objetivo de este documento es orientar a quien sea que tenga la intención de instalar Arch Linux, por los motivos que sean. Aunque se tienen como prioridad a los nuevos usuarios, se espera que sea de utilidad a cualquiera persona, sin importar su nivel de experiencia. Aunque se ha realizado con las mejores intenciones, los errores y desinformaciones no siempre pueden evitarse. Una disculpa adelantada si esto provoca cualquier inconveniente, ¡las correcciones y recomendaciones son bienvenidas!

La estructura y el flujo de esta guía son de tal forma que, según el autor, proveen una serie de instrucciones naturales para que el resultado final de la instalación y configuración de Arch Linux sea equiparable a lo análogo de cualquier otra distribución o sistema operativo. Al principio de cada sección se ofrecen enlaces a la Wiki y a otros sitios (📌) y, aunque no necesariamente se tratarán de referencias, en la mayoría de los casos dichas entradas ofrecen soporte y una mayor p