Skip to content

Instantly share code, notes, and snippets.

View josefnpat's full-sized avatar
what

Seppi josefnpat

what
View GitHub Profile
@josefnpat
josefnpat / serverlist.php
Created March 7, 2019 23:25
Simple Server List API
<?php
$mckey = "rcs";
$memcache = new Memcache;
$memcache->addServer("localhost");
$server = $memcache->get($mckey);
if($server == false){
$server = new stdClass();
$server->list = array();
@josefnpat
josefnpat / callgrind.lua
Last active February 27, 2019 23:37
Callgrind module for Lua 5.1 / LuaJIT
--[[
Copyright 2007 Jan Kneschke (jan@kneschke.de)
Copyright 2019 Josef Patoprsty (josefnpat@gmail.com)
Licensed under the same license as Lua 5.1
This is an alteration of the original lua-callgrind by Jan Kneschke.
Features:
@josefnpat
josefnpat / avoider.p8
Last active January 1, 2019 20:03
avoid game in 560 characters
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
n=9y=64s=0p={s={{-6,-6},{-2,0},{-6,6},{6,0}}}a={}q=all
function k(t,f,v)line(t.x+f[1],t.y+f[2],t.x+v[1],t.y+v[2])end
function o(t)f=nil for v in q(t.s)do if f then k(t,l,v)else f=v end l=v end k(t,l,f)end::_::r=rnd
if(btn(2))y-=2
if(btn(3))y+=2
y=max(0,min(127,y))c=color
if#a<n then
@josefnpat
josefnpat / slider.lua
Created October 10, 2018 19:30
Slider Library
--[[
Copyright (c) 2018, Josef Patoprsty
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
@josefnpat
josefnpat / compareIndexed.lua
Last active August 30, 2018 05:10
Compare Indexed Tables
function compareIndexed(t1,t2)
local t1_count = 0
for _,_ in pairs(t1) do t1_count = t1_count + 1 end
local t2_count = 0
for _,_ in pairs(t2) do t2_count = t2_count + 1 end
if t1_count ~= t2_count then
return false
end
for i,v in pairs(t1) do
if type(v) == "table" then

Abusing Drupal's SA-CORE-2018-002

I have a random server in Frankfurt. It was just a dev server, but I knew that it had a Drupal install that I forgot to patch. I was running 7.56, and should have updated, but missed the SA-CORE-2018-002 patch on this server. (If you're not patched yet, shame on you!) This is a cautionary tale...

Note to reader: this was written originally to a friend over chat, so it's rather ... chatty...

A few days ago, I get an email from my VPS telling me that the CPU has been maxed out at 100% since 10 AM.

1

@josefnpat
josefnpat / readme.md
Last active October 27, 2019 10:50
Notes on porting LÖVE games from 0.10.2 to 11.0.0

Here are some notes that I am keeping while porting RCS from 0.10.2 to 11.0.0.

love.audio.newSource

It seems that when making a new audio source, it either makes new SoundData from two strings (source,type) instead of defaulting to to the "stream" type. The simplist solution is the following:

While this monkey patch may not work in every case, I suspect it would work in most.

love.audio._newSource = love.audio.newSource
@josefnpat
josefnpat / ps4convert.sh
Created December 21, 2017 00:19
Convert video for PS4
# Copy video, convert audio:
./bin/ffmpeg/bin/ffmpeg.exe -i $1 -c:v copy -c:a libmp3lame $2
# Convert video and audio:
./bin/ffmpeg/bin/ffmpeg.exe -i $1 -crf 22 $2.mp4
@josefnpat
josefnpat / readme.md
Last active October 30, 2017 21:37
What is a Fantasy Console?

What is a Fantasy Console

  1. A Fantasy Console (FC) must not have existing hardware.

    E.g. The arduboy is not a fantasy console.

  2. A FC needs to have intentional restrictions not related to the hardware it is being deployed on.

    I feel adding the retro component (e.g. looks like X) to be defeating, as it might stifle the creation of new fantasy consoles. At the end of the day, a FC is based on a fantasy hardware product that is difficult to alter once released. For example; the fantasy console may only have a few MB of memory, whereas the system it is being deployed on may have GB of memory.

@josefnpat
josefnpat / LICENSE
Last active October 27, 2017 21:08
RGB <=> HS[L|V]
Copyright 2011 Emmanuel Oga.
Licensed under a Creative Commons Attribution 3.0
Unported License (http://creativecommons.org/licenses/by/3.0/).
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work