Skip to content

Instantly share code, notes, and snippets.

View martinsbalodis's full-sized avatar

Mārtiņš Balodis martinsbalodis

View GitHub Profile
@martinsbalodis
martinsbalodis / docker-compose.yml
Created March 1, 2017 13:09
Example of logging with docker gelf logger to logstash
---
version: '3'
services:
elasticsearch:
image: elasticsearch:5
kibana:
image: kibana:5
ports:
- "5601:5601"
logstash:
{"startUrl":"https://www.google.com/finance/historical?q=NASDAQ%3AGOOG","selectors":[{"parentSelectors":["_root","next-page"],"type":"SelectorElement","multiple":true,"id":"table-row","selector":"table.gf-table tr:nth-of-type(n+2)"},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"date","selector":"td.lm","regex":""},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"open","selector":"td.rgt:nth-of-type(2)","regex":""},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"high","selector":"td.rgt:nth-of-type(3)","regex":""},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"low","selector":"td.rgt:nth-of-type(4)","regex":""},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"close","selector":"td.rgt:nth-of-type(5)","regex":""},{"parentSelectors":["table-row"],"type":"SelectorText","multiple":false,"id":"volume","selector":"td.rgt.rm","regex":""},{"parentSelectors":["_root","ne
# Sample Makefile
TARGET := const1
OBJ := $(TARGET)_main.o $(TARGET).o
ASFLAGS = -mcpu=xscale -alh=$*.lis -L
CFLAGS = -mcpu=xscale -O0 -Wall
LDFLAGS =
@martinsbalodis
martinsbalodis / base64imagescss.php
Created May 9, 2012 19:44
Simple php CLI script for replacing css background images with base64 encoded images
<?php
/*
* Simple php CLI script for replacing css background images with base64 encoded
* images.
*
* Usage:
* base64imagescss.php ../../your/path/in.css out.css
*
* @author Martins Balodis
@martinsbalodis
martinsbalodis / autoload.php
Created March 2, 2012 19:44
Autoload Zend Framework 2 library in kohana
<?php
/**
* Enable Zend Framework autoloading
*/
if ($path = Kohana::find_file('vendor', 'Zend/library/Zend/Loader')) {
ini_set('include_path',
ini_get('include_path') . PATH_SEPARATOR . dirname(dirname($path)));
require_once 'Zend/Loader/AutoloaderFactory.php';
public function LKS2LatLong ($east, $north)
{
$K0 = 0.9996;
$FALSE_E = 500000.0;
$FALSE_N = 0;
$f = 1/298.257223563;//298.257222101;//298.257223563
$a = 6378137.0;
$e = sqrt(2.0 * $f - $f * $f);
$e_dash = sqrt($e*$e + pow($e,4)/(1.0 - $e * $e));
$north_d = $north - $FALSE_N;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package virsma3d;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
@martinsbalodis
martinsbalodis / main.c
Created October 10, 2011 15:24
atrast failu
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
void search_file(char *dir, char *search_filename) {
struct dirent *directory_result;