Skip to content

Instantly share code, notes, and snippets.

View b0c1's full-sized avatar

Janos Haber b0c1

  • Fine Solution Ltd
  • Hungary
View GitHub Profile
@b0c1
b0c1 / gist:1037593
Created June 21, 2011 10:41
Padrino multi role monkey patch
#put into the padrino boot.rb file before Padrino.load!
module Padrino
module Admin
module AccessControl
class Base
##
# Return an array of project_modules
#
def project_modules(account)
roles = account.roles if account.roles.kind_of?(Array) rescue []
@b0c1
b0c1 / CrudTest.scala
Created May 3, 2013 08:38
Activate vs Scalatra. Round 1
package hu.finesolution.sepia.test.core.controller
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.mock.MockitoSugar
import org.scalatest.{FunSuite, BeforeAndAfter}
import org.scalatra.test.scalatest.ScalatraSuite
import org.scalatra.ScalatraServlet
@b0c1
b0c1 / OrientDbTest.scala
Created May 9, 2013 22:26
OrientDB vs Scala 2.10
package hu.javaportal.test
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfter, FunSuite}
import org.scalatest.mock.MockitoSugar
import com.orientechnologies.orient.`object`.db.{OObjectDatabasePool, OObjectDatabaseTx}
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE
import javax.persistence.{Version, Id}
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
@b0c1
b0c1 / OrientDbTest.scala
Last active December 17, 2015 06:19
Orient DB 1.3 vs scala 2.10
package hu.javaportal.test
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfter, FunSuite}
import org.scalatest.mock.MockitoSugar
import com.orientechnologies.orient.`object`.db.{OObjectDatabasePool, OObjectDatabaseTx}
import com.orientechnologies.orient.core.tx.OTransaction.TXTYPE
import javax.persistence.{Version, Id}
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
package hu.javaportal.test;
import javax.persistence.Id;
import javax.persistence.Version;
import scala.ScalaObject;
import scala.reflect.ScalaSignature;
@ScalaSignature(bytes="\006\001\r4A!\001\002\001\023\t!A+Z:u\025\t\031A!\001\003uKN$(BA\003\007\003)Q\027M^1q_J$\030\r\034\006\002\017\005\021\001.^\002\001'\r\001!B\005\t\003\027Ai\021\001\004\006\003\0339\tA\001\\1oO*\tq\"\001\003kCZ\f\027BA\t\r\005\031y%M[3diB\0211CF\007\002))\tQ#A\003tG\006d\027-\003\002\030)\tY1kY1mC>\023'.Z2u\021\025I\002\001\"\001\033\003\031a\024N\\5u}Q\t1\004\005\002\035\0015\t!\001C\004\037\001\001\007I\021A\020\002\005%$W#\001\021\021\005\005\"cBA\n#\023\t\031C#\001\004Qe\026$WMZ\005\003K\031\022aa\025;sS:<'BA\022\025\021\035A\003\0011A\005\002%\na!\0333`I\025\fHC\001\026.!\t\0312&\003\002-)\t!QK\\5u\021\035qs%!AA\002\001\n1\001\037\0232\021\031\001\004\001)Q\005A\005\031\021\016\032\021)\005=\022\004CA\0329\033\005!$BA\0337\003-\001XM]:jgR,gnY3\013\003]\nQA[1wCbL!!\017\033\003\005%#\007FA\030<!\tat(D\001>\025\tqD#A\004sK\032dWm
@b0c1
b0c1 / CustomMethodFilter.java
Created May 16, 2013 09:59
Sime scala getter/setter wrapper for OrientDB
package test;
import com.orientechnologies.orient.object.enhancement.OObjectMethodFilter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class CustomMethodFilter extends OObjectMethodFilter {
protected boolean isScalaClass(Class<?> clz) {
@b0c1
b0c1 / OObjectMethodFilter.java
Created May 16, 2013 13:17
Merged OObjectMethodFilter
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer;
import javassist.util.proxy.MethodFilter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@b0c1
b0c1 / OObjectMethodFilter.java
Created May 16, 2013 20:53
Corrected OObjectMethodFilter
/*
*
* Copyright 2012 Luca Molino (molino.luca--AT--gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@b0c1
b0c1 / nsupdate.sh
Created December 2, 2014 08:36
nsupdate.info bash script
#!/bin/bash
USER="boci.nsupdate.info"
PASS="YEMLS9Yk2D"
UPDATE_COMMAND="curl -o status.ip -s --user $USER:$PASS --basic https://ipv4.nsupdate.info/nic/update"
curl -s https://ipv4.nsupdate.info/myip -o current.ip
if [ ! -f prev.ip ]
then
@b0c1
b0c1 / gist:66527e00bada1e4c0dc3
Created May 23, 2015 23:23
Strange error while starting spark
yahoo * 15/05/23 19:29:33 INFO spark.SparkContext: Running Spark version 1.3.1
yahoo * 15/05/23 19:29:34 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
yahoo * 15/05/23 19:29:34 INFO spark.SecurityManager: Changing view acls to: root
yahoo * 15/05/23 19:29:34 INFO spark.SecurityManager: Changing modify acls to: root
yahoo * 15/05/23 19:29:34 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
yahoo * 15/05/23 19:29:34 INFO slf4j.Slf4jLogger: Slf4jLogger started
yahoo * Exception in thread "main" java.lang.ClassNotFoundException: akka.actor.SelectionPath
yahoo * at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
yahoo * at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
yahoo * at java.security.AccessController.doPrivileged(Native Method)