Skip to content

Instantly share code, notes, and snippets.

View sonic2kk's full-sized avatar

Eamonn Rea sonic2kk

  • The Organization
  • 10:10 (UTC)
View GitHub Profile
@sonic2kk
sonic2kk / trivia.py
Last active September 16, 2022 04:50
Play Trivia with the Discord bot Mantaro to your hearts content. Will not work on Wayland with versions of Pynput which do not support it.
import time
import random
from pynput.keyboard import Key, Controller
keyboard = Controller()
def press(key):
#!/bin/bash
echo "Sum: "
read sum
echo "Path: "
read path
sha1sum -c <<< "$sum $path"
@sonic2kk
sonic2kk / MouseCollision.lua
Created July 16, 2015 20:00
Simple function for rectangle/mouse collision
function rectmouse_colliding(mouse_x, mouse_y, x, y, width, height)
return mouse_x > x and mouse_y < x + width and mouse_y > y and mouse_y < y + height
end
@sonic2kk
sonic2kk / CircleRectCollision.lua
Last active August 29, 2015 14:25
Simple Lua function for detecting circle/rectangle collision
local math_abs = math.abs
function circlerect_colliding(cx, cy, cr, rx, ry, rw, rh)
circleDistance_x = math_abs(cx - rx)
circleDistance_y = math_abs(cy - ry)
if circleDistance_x > (rw / 2 + cr) then
return false
end
@sonic2kk
sonic2kk / enemy.lua
Created July 16, 2015 17:21
A Gist showing the basics of how to write a system which lets you create players and optionally store them in variables
Enemies = {}
function Enemies.new(x, y, w, h, name, health)
local e = { x = x, y = y, w = w, h = h, name = name, health = health }
table.insert(Enemies, e)
return e
end
@sonic2kk
sonic2kk / main.lua
Created July 16, 2015 17:11
A Gist showing the basics of how to write a system that returns a local module in Lua/LOVE
local player = require 'player'
function love.load()
player.new(10, 10, 50, 50, 'Chandler Bing', 100)
end
function love.update(dt)
player.update(dt)
end
@sonic2kk
sonic2kk / RectCollision.lua
Last active August 29, 2015 14:25
Simple Lua function for checking bounding box collisions
function rect_colliding(x1,y1, w1, h1, x2, y2, w2, h2)
return x1 < x2 + w2 and x2 < x1 + w1 and y1 < y2 + h2 and y2 < y1 + h1
end
@sonic2kk
sonic2kk / index.html
Created February 17, 2015 18:44
Sticky CSS Footer
<!DOCTYPE html>
<html>
<head>
<title>Sticky Footer Test</title>
<!--[if lt IE 7]>
<style type="text/css">
#wrapper { height:100%; }
</style>