Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@tshirtman
tshirtman / geobar.py
Last active July 24, 2024 16:30
Naive approach to average latitude and longitude positions
import webbrowser
from functools import cache
import numpy as np
import numpy.linalg as lin
from geopy.geocoders import Nominatim
@cache
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy import properties as P
KV = '''
#:import chain itertools.chain
#:import sin math.sin
#:import pi math.pi
function! ShowWindowNumbers()
for i in range(1, winnr('$'))
" Get the buffer and window associated with this number
let bufnr = winbufnr(i)
let winid = win_getid(i)
let figlet_output = system('figlet -f small ' . i )
let popup_content = split(figlet_output, "\n")
let popup_height = 5
let popup_width = 8
let row = win_screenpos(i)[0] + (winheight(i) - popup_height) / 2
from kivy.app import App
from kivy.factory import Factory as F
from kivy.core.window import Window as W
class CrossHairCursorApp(App):
def build(self):
root = F.Widget()
with root.canvas.after:
self.v_line = F.Line(points=[])
@tshirtman
tshirtman / odo.py
Last active February 20, 2022 21:34
'''
'''
from datetime import datetime
from kivy.app import App
from kivy.lang import Builder
from kivy import properties as P
from kivy.clock import Clock
KV = '''
from kivy.app import App
from kivy.lang import Builder
KV = '''
<BorderBoxLayout@BoxLayout,BorderGridLayout@GridLayout,CanvasButton@Label+ButtonBehavior,BorderLabel@Label>:
border_width: 1
canvas.before:
Line:
rectangle: self.pos + self.size
from kivy.lang import Builder
from kivy.app import App
from kivy.properties import ListProperty, NumericProperty
KV = '''
#:import RGBA kivy.utils.rgba
<Row@BoxLayout>:
text: ''
rv_key: 0
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.uix.scatterlayout import ScatterLayout
from kivy.uix.image import AsyncImage
from kivy.properties import NumericProperty, ListProperty, StringProperty
from kivy.core.window import Window
from kivy.clock import Clock
from kivy.vector import Vector
from kivy.graphics.transformation import Matrix
from kivy import platform
from kivy.clock import Clock
from kivy.app import App
from kivy.animation import Animation
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.graphics import RenderContext
from kivy.uix.modalview import ModalView
from kivy.properties import ListProperty, NumericProperty, ObjectProperty, ColorProperty
@tshirtman
tshirtman / odds.py
Last active September 21, 2021 19:08
from random import choice
from decimal import Decimal
stats = [0] * 100
def advance(n, f):
return n * (1+f)
def backoff(n, f):