Skip to content

Instantly share code, notes, and snippets.

@todbot
todbot / bouncy_balls1.py
Last active Aug 19, 2022
use displayio to make simple bounch balls (CircuitPython, using a built-in display) video: https://twitter.com/todbot/status/1417596861184020480
View bouncy_balls1.py
# bouncy_balls1.py - 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 adafruit_display_shapes.circle 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)
reversed_string=''
i =0
while i < str.length
reversed_string=str[i] + reversed_string # reverse
i +=1
end
reversed_string
@mgrady3
mgrady3 / testframeless.py
Created Sep 24, 2017
Test Qt/PyQt Frameless Window resizing with QSizeGrip
View testframeless.py
"""
Test Qt Frameless Window resizing with QSizeGrip
Maxwell Grady, September 2017.
"""
import sys
from PyQt5 import QtCore, QtWidgets
from qtmodern.styles import dark
from qtmodern.windows import ModernWindow
@ayufan
ayufan / taskset.sh
Last active Aug 19, 2022
KVM CPU pinning for Proxmox VE
View taskset.sh
#!/bin/bash
set -eo pipefail
VMID=200
cpu_tasks() {
expect <<EOF | sed -n 's/^.* CPU .*thread_id=\(.*\)$/\1/p' | tr -d '\r' || true
spawn qm monitor $VMID
expect ">"
@MuhsinFatih
MuhsinFatih / pythondoneright.md
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
View pythondoneright.md

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
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active Aug 19, 2022
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)
View alacritty-tmux-vim_truecolor.md

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 https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@fourgeotf
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'
ALTER AUTHORIZATION on database::[NOMBASE] to sa
@cilf
cilf / Dockerfile
Last active Aug 19, 2022
Adminer MongoDB docker image
View Dockerfile
FROM adminer:4.7.1
# WATCH OUT WHEN UPGRADING, THE SED BELOW MIGHT STOP WORKING
MAINTAINER marek@cilf.cz
USER root
RUN apk add autoconf gcc g++ make libffi-dev openssl-dev
RUN pecl install mongodb
RUN echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
@customcommander
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
require('chromedriver');
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
gustawho / arch-linux-instalacion.md
Last active Aug 19, 2022
Guía de Instalación de Arch Linux
View arch-linux-instalacion.md

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