Skip to content

Instantly share code, notes, and snippets.

import pyglet
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
label = pyglet.text.Label(
"Hello, world",
font_name="Times New Roman",
font_size=36,
x=window.width // 2,
y=window.height // 2,
#!/usr/bin/env python
from enum import Enum
import math
import pyglet
from pyglet import event
from pyglet import shapes
from pyglet.window import key
# * lose game when ball hits bottom
# * change angle when it hits the paddle
#!/usr/bin/env python
import math
import pyglet
from pyglet import shapes
WIDTH = 960
HEIGHT = 960
MARGIN = 100
#!/usr/bin/env python
import pyglet
from pyglet import shapes
WIDTH = 960
HEIGHT = 540
RED = (255, 0, 0)
window = pyglet.window.Window(WIDTH, HEIGHT)
@llimllib
llimllib / padcolors.py
Last active November 21, 2024 18:50
Setting pad colors on the Novation LaunchKey Mini MK3
# This file demonstrates how to use midi codes to control the color of the
# keypads on a Novation LaunchKey mini; There is no official documentation of
# it as far as I can tell
#
# the LaunchKey MK2 Programmer's guide is useful, though not accurate to
# details on the MK3 mini:
# https://customer.novationmusic.com/sites/customer/files/novation/downloads/10535/launchkey-mk2-programmers-reference-guide.pdf
import random
import time
@llimllib
llimllib / volume.lua
Last active July 7, 2020 03:36
A script to use the first knob on my novation keyboard to control my mac's volume
-- This is a hammerspoon (http://www.hammerspoon.org/) script to hook the
-- volume knob on my keyboard up to my system's volume control
-- https://easings.net/ is great for easing functions
-- I tried easeInExpo, but it was too sharp (return 2 ^ (10 * x - 10))
-- experimentation suggested cubic was the most pleasant. Linear was expectedly
-- awful
function easeIn(x)
return x * x * x
end
# https://voidlinux.org/usage/xbps/ is a handy site for docs that isn't linked
# from the docs page, for whatever reason. Gives good xbps-* examples
# install non-free repository:
sudo xbps-install void-repo-nonfree
# update the system; all installs failed before this:
sudo xbps-install -Su
# xbps is hard to type. Add these aliases to your bashrc if xbps-install is

609.185 MURDER IN THE FIRST DEGREE.

(a) Whoever does any of the following is guilty of murder in the first degree and shall be sentenced to imprisonment for life:

(1) causes the death of a human being with premeditation and with intent to effect the death of the person or of another;

(2) causes the death of a human being while committing or attempting to commit criminal sexual conduct in the first or second degree with force or violence, either upon or affecting the person or another;

(3) causes the death of a human being with intent to effect the death of the person or another, while committing or attempting to commit burglary, aggravated robbery, kidnapping, arson in the first or second degree, a drive-by shooting, tampering with a witness in the first degree, escape from custody, or any felony violation of chapter 152 involving the unlawful sale of a controlled substance;

from csv import DictReader
from random import choice, random, randint
firstnames = []
lastnames = []
for line in DictReader(open("names.csv")):
name = line["name"].split("(")[0].strip(" +")
first, last = name.rsplit(" ", 1)
firstnames.append(first)
lastnames.append(last)
@llimllib
llimllib / mssql_to_csv.bash
Last active January 8, 2025 02:22
This is a script to convert every table in a Microsoft SQL Server database backup (.bak file) to a .csv file
#!/usr/bin/env bash
# import an MS SQL .bak backup file to an MS SQL database, then export all
# tables to csv. run this script as `import.sh <filename>`. It expects to be
# run in the same directory as the backup file.
# this is only tested on my mac (OS X Catalina). I tried to stick to posix, but
# It will probably require some tweaking for you. I hope it gives a general
# sense of what you need to do at the very least.