Skip to content

Instantly share code, notes, and snippets.

View matejuh's full-sized avatar
☁️
Out- Czech regions gliding championship

Matej Plch matejuh

☁️
Out- Czech regions gliding championship
View GitHub Profile
@matejuh
matejuh / Makefile
Created January 18, 2012 20:31
Embedding a Ruby Interpreter
LIB=/home/matej/.rvm/rubies/ruby-1.9.2-p290/lib
INC=/home/matej/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
CFLAGS=-I$(INC) -I/home/matej/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux/ -g
LDFLAGS=-L$(LIB) -ldl -lruby1.9
embed2: embed2.o
$(CC) -o embed2 embed2.o $(LDFLAGS)
@matejuh
matejuh / embeded_struct.c
Created January 19, 2012 17:14
Embedding a Ruby Interpreter- working with struct
struct Address {
char * town;
};
struct Person {
struct Address * address;
char * name;
};
static VALUE wrap_person_get_address(VALUE self) {
@matejuh
matejuh / embed.c
Created January 20, 2012 09:33 — forked from mattwildig/embed.c
Wrapping struct
/*
N.B. this program doesn't include any error checking. In particular you'll have
to do all the rb_protect stuff
*/
#include <stdio.h>
#include "ruby.h"
struct Address {
char * town;
@matejuh
matejuh / embedded.c
Created February 1, 2012 09:10
Embedded Ruby gems- gem path
#Inspired by Ruby sources gem initialization
void defineRuby() {
void Init_prelude(void);
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
ruby_script("embed traffic profiller");
rb_define_module("Gem");
@matejuh
matejuh / dynamic.cgi
Created February 22, 2012 09:02
RRD CGI with dynamic given values
#!/usr/local/rrdtool/bin/rrdcgi
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>Dynamic ratio</title>
</head>
<body>
<h1>Dynamic ratio</h1>
<div>
<p>
@matejuh
matejuh / FixtureTest.java
Created February 23, 2012 12:40
play-siena relationship
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import models.Flight;
import models.Parent;
import models.Thing;
import org.junit.After;
@matejuh
matejuh / nfdump_bindata.rb
Created April 23, 2012 20:40
Ukázka načítání nfdump souboru pomocí knihovny BitStruct a BinData
require 'bindata'
class FlowFileHeader < BinData::Record
endian :little
uint16 :magic
uint16 :version
uint32 :flags
uint32 :numBlocks
string :ident, :read_length => 128
matej@notebook:~/Downloaded/git_test_repo$ mkdir /home/matej/Images/test1
matej@notebook:~/Downloaded/git_test_repo$ touch /home/matej/Images/test1/foo1
matej@notebook:~/Downloaded/git_test_repo$ mkdir /home/matej/Documents/test2
matej@notebook:~/Downloaded/git_test_repo$ touch /home/matej/Documents/test2/foo2
matej@notebook:~/Downloaded/git_test_repo$ cd ..
matej@notebook:~/Downloaded$rm -rd git_test_repo
matej@notebook:~/Downloaded$ mkdir git_test_repo
matej@notebook:~/Downloaded$ git --git-dir=./git_test_repo/ init
Initialized empty Git repository in /home/matej/Downloaded/git_test_repo/
@matejuh
matejuh / gist:4551004
Created January 16, 2013 21:11
Create Spring Roo Hello world project with automatic generated json API.
project --topLevelPackage cz.spring.swagger
persistence setup --database H2_IN_MEMORY --provider HIBERNATE
entity jpa --class cz.spring.swagger.domain.Word
field string --fieldName name --notNull true --unique true
field string --fieldName definition --notNull true
json all
controller all --package cz.spring.swagger.controller
web mvc json all
exit
public void HelloWorld(){
System.out.println("Hello World");
}