Skip to content

Instantly share code, notes, and snippets.

View seralf's full-sized avatar
🎯
Focusing

Alfredo Serafini seralf

🎯
Focusing
View GitHub Profile
# /etc/environment
JAVA_HOME="/usr/lib/jvm/java-7-oracle"
JRE_HOME="/usr/lib/jvm/java-7-oracle/jre"
PATH="...(other path):$JAVA_HOME:$JRE_HOME"
/**
* actor wrapping access for browser socket
*/
class BrowserSocket(
val s: WebSocketConnection,
val userId: Long,
val teamId: Long
) extends Actor {
@seralf
seralf / hello.bat
Last active December 15, 2015 22:09
Recipes for scala scripting in shell/windows :-) from the official documentation: http://www.scala-lang.org/docu/files/tools/scala.html
::#!
@echo off
call scala -savecompiled %0 %*
goto :eof
::!#
/*
* this is a scala script for Windows!
*/
Console.println("Hello, world!")
argv.toList foreach Console.println
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<jvmArgs>-Xmx1024</jvmArgs>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8888</port>
<maxIdleTime>60000</maxIdleTime>
@seralf
seralf / split_flac.sh
Last active March 7, 2024 07:52
Simple shell script to split a single flac file using a cue file. The .flac file and .cue file must have the same name.
#!/bin/bash
sudo apt-get install cuetools shntool flac
cuebreakpoints $1.cue | shnsplit -o flac $1.flac
@seralf
seralf / split_pdf.sh
Last active December 16, 2015 12:08
Example command line to extract part of of a PDF file and save pages to a new PDF.
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=1 -dLastPage=10 -sOutputFile=extractedFile.pdf originalFile.pdf
@seralf
seralf / schema.xml
Last active July 10, 2016 14:07
Start Example for a simple deduplication scenario using Solr.
<?xml version="1.0" ?>
<schema name="simple" version="1.1">
<types>
<fieldtype name="string" class="solr.StrField" />
<fieldType name="uuid" class="solr.UUIDField" indexed="true" />
</types>
<fields>
@seralf
seralf / merge-pdf.sh
Created June 9, 2013 11:40
merge several pdf in alphabetical order
# merge several pdf in alphabetical order
pdftk *.pdf cat output mergedFile.pdf
@seralf
seralf / webserver.py
Last active July 17, 2023 02:49
Start a local webserver into the current directory, for serving local static files. (This is useful when testing ajax locally on json, for example.)
#!/usr/bin/python
# start an http webserver serving static files from the local directory, using python
python -m SimpleHTTPServer 7777 &
@seralf
seralf / StanfordNERExample.scala
Last active June 6, 2018 22:39
A simple, introductory example, to play with Stanford Named Entity Recognition tool with the scala language. NOTE: the model used here is one of the provided model in the standard distribution.
package ner
import edu.stanford.nlp.ie.crf.CRFClassifier
import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import edu.stanford.nlp.ling.CoreAnnotations
import java.util.ArrayList
import java.util.HashMap
import java.util.Map
import scala.xml.XML