Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Rico P RicoP

🎯
Focusing
Block or report user

Report or block RicoP

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View btnd.lua
-- helper function for buttons state
-- call btn_update ONCE per update
-- btnd returns true once the button is pressed down
-- btnu returns true when the button is released
do
local state = {0,0,0,0,0,0}
-- call this in _update!
btn_update=function ()
for b=0,6 do
View defer.h
//from https://pastebin.com/3YvWQa5c
#define CONCAT_INTERNAL(x,y) x##y
#define CONCAT(x,y) CONCAT_INTERNAL(x,y)
template<typename T>
struct ExitScope {
T lambda;
ExitScope(T lambda):lambda(lambda){}
~ExitScope(){lambda();}
@RicoP
RicoP / strexpr.h
Created Jul 11, 2018
check string equality with const expressions [c++11]
View strexpr.h
constexpr bool constStringEquals(const char * lhs, const char * rhs) {
return (*lhs) != (*rhs)
? false
: ((*lhs) == 0
? true
: constStringEquals(lhs + 1, rhs + 1)
);
}
constexpr bool constStringEndsWith(const char * str, const char * suffix) {
@RicoP
RicoP / RIP.bat
Created Mar 18, 2018
Rip Audio CD with VLC
View RIP.bat
@ECHO OFF
setlocal ENABLEDELAYEDEXPANSION
SET /a x=0
FOR /R H:\ %%G IN (*.cda) DO (CALL :SUB_VLC "%%G")
GOTO :eof
:SUB_VLC
@RicoP
RicoP / block.js
Last active May 31, 2019
youtube mini ad block (When you don't want to use ad block, but still don't want to manually click the close button for the ad)
View block.js
// ==UserScript==
// @name youtube mini ad block
// @namespace Violentmonkey Scripts
// @grant none
// @include https://www.youtube.com/*
// ==/UserScript==
var started = false;
var adWholeTime = 0;
View gif2gifv.user.js
(function () {
var links = document.getElementsByTagName("a")
var regex = /imgur.com.*gif$/ig
for(var i = 0; i != links.length; ++i) {
var href = links[i].href;
if(regex.test(href))
{
links[i].setAttribute('href', href + "v");
console.log(href)
@RicoP
RicoP / gist:7357080
Last active May 1, 2019
NES Rescources
View gist:7357080
http://www.6502.org/tutorials/6502opcodes.html
http://www.thealmightyguru.com/Games/Hacking/Wiki/index.php?title=6502_Opcodes
http://nesdev.com/6502.txt
http://mystuffisallhere.com/blog/post/2008/08/24/Page-boundary-crossings-on-the-6502.aspx
View gist:5895145
while :
do
for q in bomb terror destroy
do
curl -A MOZILLA "https://www.google.com/search?q=$q" > /dev/null
done
done
@RicoP
RicoP / gist:5664550
Created May 28, 2013
Handy clang flags
View gist:5628767
$ mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk
$ mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/
You can’t perform that action at this time.