Skip to content

Instantly share code, notes, and snippets.

View vgel's full-sized avatar

Theia Vogel vgel

View GitHub Profile
@vgel
vgel / app.py
Last active December 20, 2022 23:28
Simple RSS proxy to add title elements to a Mastodon feed
# put in rss_proxy/ as app.py and run with `python -m flask run`
# requirements: flask beautifulsoup4 requests lxml
# usage: `curl localhost:5000?feed=https://instance.example.com/users/username.rss`
from bs4 import BeautifulSoup
from flask import Flask, request
import requests
from lxml.builder import E
import lxml.etree
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.5.3/pixi.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/planck-js/0.1.34/planck-with-testbed.js"></script>
</head>
<body>
@vgel
vgel / installingamarok.mkd
Last active February 13, 2022 02:29
How to compile and install Amarok

How to Build (and Install) Amarok from Source

First, install the build dependencies for amarok. Mostly, these are just headers and support libraries to hook into KDE. On debian-based systems, you can simply run # apt-get install build-essential git-core; apt-get build-dep amarok as root.

Then, using git, clone the amarok repository from KDE's anongit:

git clone git://anongit.kde.org/amarok.git; cd amarok

Before doing anything else, you should check the README and INSTALL files to see if anything has changed in these steps. They will note any important build updates.

@vgel
vgel / kinect-scroll.py
Created July 1, 2013 23:01
Some kinect scrolling junk
#! /usr/bin/python
from openni import *
import kinect_motor
import uinput
import math
grabbed = False
def setup_uinput():
@vgel
vgel / RenderPortal
Created June 16, 2013 03:28
FUCK FUCK FUCK
WorldServer worldServer = DimensionManager.getWorld(dim);
if (worldServer == null) {
DimensionManager.initDimension(dim);
worldServer = DimensionManager.getWorld(dim);
}
if (dim != dimRendering) {
dimRendering = dim;
privRG.setWorldAndLoadRenderers(Minecraft.getMinecraft().theWorld);
}
System.out.println("render " + MinecraftForgeClient.getRenderPass());
import re, logging, time, cProfile
class Word(object):
def __init__(self, function, name, types, inputs):
if name == '':
raise ValueError("Invalid name.")
self.name = name
self.function = function
self.types = types
from math import *
import random, time, pygame
x=0
y=1
z=2
def t3d_2d(a,c,t,e):
dx = cos(t[y]) * (sin(t[z]) * (a[y] - c[y]) + cos(t[z]) * (a[x] - c[x])) - sin(t[y]) * (a[z] - c[z])
dy = sin(t[z]) * (cos(t[y]) * (a[z] - c[z]) + sin(t[y]) * (sin(t[z]) * (a[y] - c[y]) + cos(t[z]) * (a[x] - c[x]))) + cos(t[x]) * (cos(t[z]) * (a[y] - c[y]) - sin(t[z]) * (a[x] - c[x]))
dz = cos(t[x]) * (cos(t[y]) * (a[z] - c[z]) + sin(t[y]) * (sin(t[z]) * (a[y] - c[y]) + cos(t[z]) * (a[x] - c[x]))) - sin(t[x]) * (cos(t[z]) * (a[y] - c[y]) - sin(t[z]) * (a[x] - c[x]))
@vgel
vgel / golfed-msgboard.py
Created July 23, 2012 12:47
A simple message-board-type site in golfed python. Expanded version below if you can't read golfed code or want comments.
import BaseHTTPServer as b,sys,os,json,urlparse
p=(json.loads(open(sys.argv[1]).read()) if os.path.exists(sys.argv[1]) else {})
n="<br/>"
h="""<form action=%s method="post">Post: <textarea name="a"></textarea><input type="submit" value="Post!"/></form>"""
y=lambda s:urlparse.parse_qs(s)['a'][0]
class F(b.BaseHTTPRequestHandler):
def do_GET(s):
s.send_response(200)
s.send_header("Content-type","text/html")
s.end_headers()
@vgel
vgel / a.py
Created July 20, 2012 19:55
simple platformer. run python a.py mapfile
import pygame as pg,sys
pg.init()
w=pg.display.set_mode((100,)*2)
o=list(open(sys.argv[1]).read().replace("\n",""))
px=py=50
j=0
k=pg.key.get_pressed
t=lambda x,y:o[x/5+y/5*20]
z=lambda i:min(95,max(0,i))
while True:
@vgel
vgel / gist:3098126
Created July 12, 2012 13:32
A autocomplete-like word suggester. Run with `python <file> "/usr/share/dict/words"` Enter words at command line and hit enter for suggestions
import sys
t={}
def w(o):
c=t
for l in o:
c[l]=c[l]if l in c else{}
c=c[l]
c[None]=None
g=lambda t,b,i:reduce(lambda i,l:i+[b]if l is None else g(t[l],b+l,i),t,i)
map(w,open(sys.argv[1]).read().split("\n"))