Skip to content

Instantly share code, notes, and snippets.

@kolen
kolen / sdl_input_test.c
Created April 9, 2019 15:46
SDL2 keyboard event test script
#include <SDL.h>
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_EVENTS);
SDL_Window *window = NULL;
window = SDL_CreateWindow("title", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 512, 512, SDL_WINDOW_OPENGL);
SDL_Event event;
while(1) {
while(SDL_PollEvent(&event)) {
export IDF_PATH=...
pip3 install -r $IDF_PATH/docs/requirements.txt
cd $IDF_PATH/docs/en
make html
@kolen
kolen / pcx2wal
Created January 14, 2019 18:07
Testing of utils from quake 2 engine
~/items/qengine/build % mv quake2.pal palette.pal
~/items/qengine/build % tools/pcx2wal quake2-generated-colormap.pcx
PCX2WAL (c) Iikka Keränen 1997-1998
1 texture to be converted...
quake2-generated-colormap.pcx ... quake2-generated-colormap saved as quake2-generated-colormap.wal
~/items/qengine/build % ls -l quake2-generated-colormap.wal
-rw-r--r-- 1 kolen staff 108900 14 янв 21:06 quake2-generated-colormap.wal
require "ruby-prof"
RubyProf.measure_mode = RubyProf::ALLOCATIONS
RubyProf.start
result = RubyProf.stop
RubyProf::CallTreePrinter.new(result).print()
meta:
id: magic_and_mayhem_map
file-extension: map
endian: le
seq:
- id: version # 6 is correct
type: u4
- id: size_x
type: u4
- id: size_y
# based on https://github.com/saniv/sau/blob/master/src/fmt_spr.c
meta:
id: magic_and_mayhem_sprite
file-extension: spr
application: Magic & Mayhem
endian: le
seq:
- id: magic
contents: "SPR\0"
- id: file_size
c++ -Wall -O2 -std=c++0x -I /Users/kolen/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/sassc-1.12.1/ext/libsass/include -stdlib=libc++ -fPIC -fPIC -c -o src/ast.o src/ast.cpp
In file included from src/ast.cpp:2:
In file included from src/ast.hpp:14:
In file included from src/ast_fwd_decl.hpp:11:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/unordered_map:369:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__hash_table:314:28: error: use of undeclared identifier '__get_db'
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__hash_table:345:30: error: use of undeclared identifier '__get_const_db'
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
@kolen
kolen / transport.overpass
Created March 27, 2018 13:41
Find transport route relations inside administrative boundary with overpass api
area[boundary=administrative][wikidata=Q1193156] -> .city; // Q656
(
node[public_transport](area.city);
node[highway=bus_stop](area.city);
<<;
) -> ._;
out;
@kolen
kolen / content_type_warn_stacktrace.txt
Last active March 13, 2018 23:44
Stack trace for "warning: Content-Type did not set; using application/x-www-form-urlencoded"
Backtrace:
--
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http/generic_request.rb:303:in `supply_default_content_type'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http/generic_request.rb:185:in `send_request_with_body'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http/generic_request.rb:121:in `exec'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:1444:in `block in transport_request'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:1443:in `catch'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:1443:in `transport_request'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/2.4.0/net/http.rb:1416:in `request'
/Users/kolen/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/webmock-3.0.1/lib/webmock/http_lib_adapters/net_http.rb:97:in `block in request'
@kolen
kolen / bundler_inline.rb
Created March 1, 2018 17:37
Rubinius load path strange behavior
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'test-unit'
end
puts $LOAD_PATH
require 'test/unit'