Skip to content

Instantly share code, notes, and snippets.

View orlp's full-sized avatar
⚠️
This user's social credit score is unknown.

Orson Peters orlp

⚠️
This user's social credit score is unknown.
  • Leiden, Netherlands
View GitHub Profile
local function getcolor(unit)
local reaction = UnitReaction(unit, "player") or 5
if UnitIsPlayer(unit) then
local _, class = UnitClass(unit)
local color = RAID_CLASS_COLORS[class]
return color.r, color.g, color.b
elseif UnitCanAttack("player", unit) then
if UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or UnitIsDead(unit) then
return 136/255, 136/255, 136/255
if not TukuiCF["raidframes"].enable == true then return end
local raid_width = TukuiDB.Scale((TukuiActionBarBackground:GetWidth() / 5) - 7)*TukuiCF["raidframes"].scale
local raid_height = TukuiDB.Scale(24)*TukuiCF["raidframes"].scale
local function Shared(self, unit)
self.colors = TukuiDB.oUF_colors
self:RegisterForClicks("LeftButtonDown", "RightButtonDown")
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
local model = CreateFrame("PlayerModel", "CombatIndicator", UIParent)
model:SetScript("OnAnimFinished", function(model) model:SetModel(nil) end)
model:SetScript("OnEvent", function(model) model:SetModel([[spells\rake.mdx]]) end)
model:RegisterEvent("PLAYER_REGEN_ENABLED")
model:RegisterEvent("PLAYER_REGEN_DISABLED")
model:SetSize(500, 500)
model:SetFrameStrata("BACKGROUND")
model:SetFrameLevel(0)
model:SetPoint("LEFT")
@orlp
orlp / chat.lua
Created December 16, 2010 22:36 — forked from anonymous/chat.lua
local addmsg = ChatFrame1.AddMessage
local function hook(frame, text, ...)
if text:find(gsub(ERR_AUCTION_SOLD_S,'%%s', '')) then -- "A buyer has been found for your auction of %s."
local itemname = text:match(gsub(ERR_AUCTION_SOLD_S, '%%s', '(.+)'))
text = "|cffef4341"..BUTTON_LAG_AUCTIONHOUSE.."|r - |cffBCD8FF"..ITEM_SOLD_COLON.."|r "
local _, solditem = GetItemInfo(itemname)
if solditem then
text = text..solditem
else
text = text..itemname
@orlp
orlp / archives.c
Created December 19, 2010 18:27
unpacks a tar archive
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "zlib.h"
struct tarheader { // for parsing the tar headers
char name[100];
char mode[8];
def interpolate_angle(a, b, alpha):
a, b = math.radians(a), math.radians(b)
# add up weighted unit vectors
vx = math.cos(a) * (1 - alpha) + math.cos(b) * alpha
vy = math.sin(a) * (1 - alpha) + math.sin(b) * alpha
# is our unit vector undefined? then return counter-clockwise increasing rotation
if vx == 0 and vy == 0:
return (math.degrees(a) + 180 * alpha) % 360
from __future__ import division, print_function
import pyglet
import map
import function
class Game:
PHYSICS_TIMESTEP = 1/60 # how often the physics should be updated in seconds
#!/usr/bin/env python3
import random
import collections
def primesbelow(N):
# http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
#""" Input N>=6, Returns a list of primes, 2 <= p < N """
correction = N % 6 > 1
N = {0:N, 1:N-1, 2:N+4, 3:N+3, 4:N+2, 5:N+1}[N%6]
CC=gcc
CFLAGS=-O3 -Wall -std=c99
LIBS=-s
main.exe: main.o
${CC} -o main.exe main.o ${LIBS}
main.o: main.c
${CC} ${CFLAGS} -c -o main.o main.c
@orlp
orlp / gist:1361232
Created November 12, 2011 22:37 — forked from Orpheon/gist:1361229
CC=gcc
CFLAGS=-O3 -Wall -std=c99
LIBS=-s
main.exe: main.o
${CC} -o main.exe main.o ${LIBS}
main.o: main.c
${CC} ${CFLAGS} -c -o main.o main.c