Skip to content

Instantly share code, notes, and snippets.

View andsve's full-sized avatar
🍎
Coding

Sven Andersson andsve

🍎
Coding
View GitHub Profile
@andsve
andsve / gist:638884
Created October 21, 2010 17:15
lol wut
{
["components"] = {
["Block_render_5"] = {
["modelfilepath"] = "",
["type"] = "geometry",
["connections_in"] = {
[1] = {
["input"] = 1,
["block"] = "Block_aux_1",
["type"] = "vec3constant",
[{"blockName" : "Block_aux_1",
"blockType" : "AuxComp",
"blockData" : {"auxType" : "script",
"src" : "return 100.0, 0.0, 0.0"
},
"blockOutput" : [{"name" : "output1",
"type" : "vec3"}]
},{"blockName" : "Block_aux_2",
"blockType" : "AuxComp",
"blockData" : {"auxType" : "script",
{
["components"] = {
["Block_render_5"] = {
["output_type"] = "texture",
["type"] = "geometry",
["connections_in"] = {
[1] = {
["input"] = 1,
["block"] = "Block_aux_1",
["type"] = "vec3constant",
module("modules/imgcache/imgcache")
function get_image(url)
local socket = require("socket")
-- get host and path
local socketurl = require("socket.url")
local parsedurl = socketurl.parse(url)
local host = parsedurl.host
module("modules/imgcache2/imgcache2")
function parse_message(bot, msg)
local i,j,chan,s = string.find(msg, ":.-!.- PRIVMSG (.-) :(.+)")
if not (i == nil) then
function db_connect()
local luasql = require("luasql.sqlite3")
local env = luasql.sqlite3()
local conn = env:connect("imgcache2.sqlite")
@andsve
andsve / Unblock SOPA
Created January 18, 2012 14:13
Copy and paste into URL bar while visiting Wikipedia, press enter and you should be able to see the article again. PROTIP: Make it a bookmark for easy access!
javascript:e=["mw-page-base","mw-head-base","content","mw-head","mw-panel","footer"];for(var l in e){document.getElementById(e[l]).style.display="block";};document.getElementById("mw-sopaOverlay").style.display="none";void(0);
@andsve
andsve / JSON.lua
Created March 10, 2012 14:59
BigBrother Sweden Tweet-Getter
-- -*- coding: utf-8 -*-
--
-- Copyright 2010-2011 Jeffrey Friedl
-- http://regex.info/blog/
--
local VERSION = 20111207.5 -- version history at end of file
local OBJDEF = { VERSION = VERSION }
--
-- Simple JSON encoding and decoding in pure Lua.
--[[
http://people.ee.ethz.ch/~pascmu/documents/procedural_modeling_of_cities__siggraph2001.pdf
]]
--[[
from: http://www.newton64.ca/blog/?p=747#7472
@andsve
andsve / Makefile
Created October 8, 2014 08:44
Ogre 1.10.x Test for Emscripten
emsc:
em++ ogre_test.cpp -I/usr/ogre/OgreMain/include/ -I/usr/ogre/build/include/ -I/usr/ogre/RenderSystems/GLES2/include/ -I/usr/ogre/PlugIns/OctreeSceneManager/include/ -I/usr/ogre/Components/RTShaderSystem/include/ -o ogre_test.bc -Werror
em++ ogre_test.bc /usr/ogre/build_static/lib/libRenderSystem_GLES2Static.a /usr/ogre/build_static/lib/libPlugin_OctreeSceneManagerStatic.a /usr/ogre/build_static/lib/libOgreRTShaderSystemStatic.a /usr/ogre/build_static/lib/libOgreMainStatic.a -o ogre.html --preload-file assets/plugins.cfg --preload-file assets/media/models/ogrehead.mesh --preload-file assets/media/materials/scripts/Ogre.material --preload-file assets/media/materials/scripts/cool.frag --preload-file assets/media/materials/scripts/cool.vs
native:
g++ -L/usr/lib/x86_64-linux-gnu/ -lfreeimage -lpthread -lX11 -lXt -lXmu -lXaw -lm -lGL -lGLU -lXrandr ogre_test.cpp -I/usr/ogre/OgreMain/include/ -I/usr/ogre/build/include/ -I/usr/ogre/RenderSystems/GL/include/ -I/usr/ogre/PlugIns/OctreeSceneManager/include/ -I
@andsve
andsve / gist:03ef7c2f911d3b061c55
Last active August 29, 2015 14:08
Faking a JavaScript "local" context + exporting predefined specific functions.
function FakeContext( src ) {
return (Function( '"use strict";' +
"if (this != window) {" +
" for (var __i in this) {" +
" eval( 'var ' + __i + ' = this[ __i ];' );" +
" }" +
"}" +
src +
"\n" +
"if (typeof(initialize) != 'undefined') { this.initialize = initialize; };" +