Skip to content

Instantly share code, notes, and snippets.

View wolfiestyle's full-sized avatar

wolfiestyle

  • Chile
View GitHub Profile
@wolfiestyle
wolfiestyle / gist:5008743
Created February 21, 2013 22:04
js functions to convert between hex string and rgb object colors
function hexToRgb(hex)
{
var res = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return res ? {
r: parseInt(res[1], 16),
g: parseInt(res[2], 16),
b: parseInt(res[3], 16)
} : null;
}
@wolfiestyle
wolfiestyle / test.asm
Created March 19, 2013 22:06
example asm code with function call
; example ASM code
; compile with 'nasm -f elf test.asm && gcc -m32 -o test test.o'
bits 32 ; use 32 bit architecture
global main ; declare 'main' funcion (called by the OS)
extern printf ; 'printf' from libc
; read-only variables
section .data
strDesu db "desu desu purrRRrRr %d", 10, 0 ; string, must end with 0, the 10 is "\n"
@wolfiestyle
wolfiestyle / unicode.txt
Created June 10, 2013 22:21
unicode test
╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
@wolfiestyle
wolfiestyle / zshrc
Created September 12, 2013 18:53
zshrc
# completion
autoload -U compinit && compinit
zstyle ':completion:*:descriptions' format '%F{green}%B-- %d%b%f'
zstyle ':completion:*:warnings' format '%F{red}%Bno matches for:%b%f %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select
zstyle ':completion:*' special-dirs ..
zstyle ':completion:*:*:kill:*' command 'ps -u$USER -o pid,%cpu,tty,cputime,cmd'
# correction
@wolfiestyle
wolfiestyle / twitter.css
Last active December 23, 2015 16:49 — forked from wchristian/twitter.css
a user css file to make twitter.com more compact
.promoted-tweet {
display: none;
}
.wrapper {
width: 95% !important;
}
.content-main {
width: 75% !important;
@wolfiestyle
wolfiestyle / LoL_forums_lolking_links.user.js
Last active December 25, 2015 05:09
adds a lolking link to user names
#!/usr/bin/gsl-shell -i
function clamp(n, min, max)
if n < min then return min end
if n > max then return max end
return n
end
ap = 420
-- Micro web framework for writing REST applications.
-- Made by @wolfiestyle
-- Last modified: 2015-02-01
-- License: MIT/X11
local error, ipairs, math_random, next, pairs, require, select, setmetatable, string_char, table_concat, tonumber, tostring, type, unpack =
error, ipairs, math.random, next, pairs, require, select, setmetatable, string.char, table.concat, tonumber, tostring, type, unpack
local stderr = io.stderr
local Request = require "wsapi.request"
local Response = require "wsapi.response"
#!/usr/bin/env wsapi.cgi
local fw = require "framework"
local app = fw.app.new()
app:setup_session("s3cret key")
local page_home = [[
<!DOCTYPE html>
<html>
@wolfiestyle
wolfiestyle / sphtrace.lua
Last active October 4, 2015 19:16
Sphere tracing in Lua
#!/usr/bin/env luajit
local abs, log, max, min, sqrt, tan = math.abs, math. log, math.max, math.min, math.sqrt, math.tan
local function normalize3(x, y, z)
local len = sqrt(x*x + y*y + z*z)
return { x / len, y / len, z / len }
end
local function normalize(vec)
return normalize3(vec[1], vec[2], vec[3])