Skip to content

Instantly share code, notes, and snippets.

View josefnpat's full-sized avatar
what

Seppi josefnpat

what
View GitHub Profile
@josefnpat
josefnpat / conv.php
Created June 6, 2013 04:23
Book Convert
#!/usr/bin/php
<?php
$start = $argv[1];
$stop = $argv[2];
for($i=$start; $i<=$stop; $i++){
$exe = "convert $i.png -rotate 270 $i.png";
echo "$exe\n";
`$exe`;
// Left page
@josefnpat
josefnpat / tf2items.md
Last active December 19, 2015 06:49
TF2 Items

This list is;

  • Non-aesthetic items only
  • No stock items
  • Unique sets (e.g. Frying Pan == Holy Mackerel)
  • All items are craft, unless otherwise labeled

Scout

  • COMPLETE
<?php
class database_abstraction_layer {
// Store the entire db in memory, but make sure it's inaccesable to the user.
private $db;
// This is the file that this DAL will operate on. In MySQL, this will be configs.
private $file;
// This is the construct function that is called when the dal object is created.
public function __construct($file){
@josefnpat
josefnpat / sample.lua
Last active December 20, 2015 14:59
Sample json usage
require('settings')
saveme = {}
saveme.colors = {}
saveme.colors.red = {255,0,0}
saveme.colors.green = {0,255,0}
saveme.colors.blue = {0,0,255}
saveme.recors = {
{name = "Seppi", "value" = 2},
@josefnpat
josefnpat / openURL.lua
Last active December 20, 2015 20:19
Thank you ananasblau @TomK32
function openURL(url)
if love._os == 'OS X' then
os.execute('open "' .. url .. '"')
elseif love._os == 'Windows' then
os.execute('start "' .. url .. '"')
elseif love._os == 'Linux' then
os.execute('xdg-open "' .. url .. '" &')
end
end
local function print_r (t, indent) -- alt version, abuse to http://richard.warburton.it
local indent=indent or ''
for key,value in pairs(t) do
io.write(indent,'[',tostring(key),']')
if type(value)=="table" then io.write(':\n') print_r(value,indent..'\t')
else io.write(' = ',tostring(value),'\n') end
end
end
local function isReserved(fname)
@josefnpat
josefnpat / sounds.lua
Created August 27, 2013 20:43
Make lots of sounds like crazy
require 'slam' -- https://raw.github.com/vrld/slam/master/slam.lua
local sound = love.audio.newSource('sound.ogg')
function love.update()
love.audio.stop(sound)
love.audio.play(sound)
end
@josefnpat
josefnpat / sounds2.lua
Created September 9, 2013 15:44
Play sounds all at once - raidho36
local _channels = { }
local _sounds = { }
_sounds.sound1 = love.audio.newSoundData ( "sound1.ogg" )
_sounds.sound2 = love.audio.newSoundData ( "sound2.ogg" )
-- etc.
function playSound ( sound )
if not _channels[ sound ] then _channels[ sound ] = { } end
local chan = _channels[ sound ]
@josefnpat
josefnpat / rpi_gpio.lua
Created September 9, 2013 19:31
Raspberry Pi GPIO handlers for LuaJIT, original version: http://lua-users.org/lists/lua-l/2012-04/msg01122.html
--Mike
-- Raspberry Pi GPIO module.
-- Written by Mike Pall. Public domain.
local setmt = setmetatable
local bit = require("bit")
local band, bor, shl, shr = bit.band, bit.bor, bit.lshift, bit.rshift
local ffi = require("ffi")
local C = ffi.C
@josefnpat
josefnpat / dipswitch.lua
Created September 17, 2013 06:45
Dip Switch for Love
local dipswitch = {}
dipswitch.theme = {}
dipswitch.theme.default = {}
dipswitch.theme.default.dip = {}
dipswitch.theme.default.dip.padding = 8
dipswitch.theme.default.dip.color = {2,105,223}
dipswitch.theme.default.switch = {}
dipswitch.theme.default.switch.x = 16
dipswitch.theme.default.switch.y = 32