Skip to content

Instantly share code, notes, and snippets.

@aritzg
aritzg / pyspark
Last active August 16, 2017 15:22
new data challenge
'''
def to_list(a):
return [a]
def append(a, b):
a.append(b)
return a
def extend(a, b):
a.extend(b)
return a
'''
@aritzg
aritzg / init pyspark.sh
Created July 18, 2017 20:22
Init pyspark
export SPARK_HOME="/home/aritz/data/personal/proiektuak/nemDataChallenge/spark-2.2.0-bin-hadoop2.7"
export PATH=$SPARK_HOME/bin:$PATH
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'
pyspark
@aritzg
aritzg / pageKeywords.ftl
Last active June 4, 2019 19:00
liferay freemarker portalUtil request add page keywords
<#assign PortalUtil = staticUtil["com.liferay.portal.util.PortalUtil"] />
<#assign serviceContext = staticUtil["com.liferay.portal.service.ServiceContextThreadLocal"].getServiceContext()>
<#assign httpServletRequest = serviceContext.getRequest()>
<#if .vars['keywords']??>
<#assign kWords = .vars['keywords'].getData()>
<#else>
<#assign kWords = "">
</#if>
@aritzg
aritzg / AccountUtil
Created July 10, 2013 07:02
AccountUtil
package net.sareweb.android.lostandfound.util;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import com.google.android.gms.auth.GoogleAuthUtil;
/**
* Created by aritz on 11/06/13.
@aritzg
aritzg / gist:5957529
Created July 9, 2013 13:54
clickOnBtnShare
@Click(R.id.btnShare)
void clickOnBtnShare(){
Intent shareIntent = new PlusShare.Builder(this)
.setType("text/plain")
.setText("Testing Google+ Share!")
.setContentUrl(Uri.parse("http://txootx.org/web/guest/play"))
.getIntent();
startActivityForResult(shareIntent, 0);
}
@aritzg
aritzg / APKAutoUpdate.java
Created October 22, 2012 19:14
APK auto-update routines
private boolean newVersionAvailable(){
Log.d(TAG, "Check for updates");
RestUtils.initRestTemplate(apkRestClient.getRestTemplate());
Log.d(TAG, "Remote version " + apkRestClient.getVersion());
return false;
}
private void update() {
Log.d(TAG, "Updating apk");
String apkurl = "http://aaa/aaa.apk";