Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@eduuh
eduuh / smart-caps-lock.md
Last active May 3, 2022 16:56 — forked from tanyuan/smart-caps-lock.md
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

  • Send Escape if you tap Caps Lock alone.
  • Send Control if you press Caps Lock with another key.
  • send caps lock if you press both shift keys together

For vim , emacs and normal day typing

@tshirtman
tshirtman / drag.py
Created January 24, 2020 22:25
drag behavior with initial position in float layout
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
<Floaty@DragBehavior+Image>:
size_hint: None, None
size: self.texture_size
drag_rectangle: self.pos + self.size
@tshirtman
tshirtman / main.py
Last active January 7, 2020 22:17
snaaaaake
from random import randint
from kivy.app import App
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.properties import ListProperty, NumericProperty
from kivy.vector import Vector
from kivy.core.window import Window
@tshirtman
tshirtman / rv_animate_items.py
Last active June 16, 2022 01:39
use a proxy widget to animate items of a recycleview without leaking on other widgets.
from copy import copy
from kivy.app import App
from kivy.clock import triggered
from kivy.lang import Builder
from kivy.animation import Animation
from kivy.factory import Factory as F
from kivy.properties import (
ObjectProperty, ListProperty
)
from base64 import b64encode, b64decode
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa, padding
def gen(key_name):
'generate a public/private keypair'
private_key = rsa.generate_private_key(
@tshirtman
tshirtman / langton.py
Last active April 7, 2021 15:43
langton ant example using kivy
from threading import Thread
import numpy as np
from time import sleep
from kivy.app import App
from kivy.graphics.texture import Texture
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.properties import ObjectProperty
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.properties import NumericProperty, ListProperty
from kivy.uix.label import Label
__all__ = ['RoundLabel']
KV = '''
#:import chain itertools.chain
#:import sin math.sin
#:import cos math.cos
@tshirtman
tshirtman / slowdown.py
Last active May 24, 2021 10:52
A Spinner/DropDown that opens progressively by animationg opacity of the items.
from kivy.uix.dropdown import DropDown
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import NumericProperty
from kivy.animation import Animation
KV = '''
FloatLayout:
Spinner:
dropdown_cls: 'SlowDown'
from array import array
from itertools import chain
from random import randint, random
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ListProperty
from kivy.graphics.texture import Texture
from kivy.graphics import Rectangle
#:/usr/bin/env python3
from string import ascii_uppercase
from random import choice
from kivy.core.window import Window
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty, NumericProperty
from kivy.clock import Clock