Skip to content

Instantly share code, notes, and snippets.

@oscarrenalias
oscarrenalias / README.md
Created April 11, 2025 20:01
Script that converts a bunch of separate markdown files into a single continuous PDFs that retains assets (images), tables of contents as well as links.

Requires the following brew packages to be installed in MacOS, actual list and names will vary depending on operating system:

pandoc
texlive
@oscarrenalias
oscarrenalias / nodeserver.js
Created October 29, 2011 12:37
A very simple Node.js static file server, based on lightnode (https://github.com/ngspinners/lightnode)
//
// A very simple Node.js static file server and Ajax proxy, based on lightnode (https://github.com/ngspinners/lightnode)
//
// Requirements:
// Node.js
// npm for the installation of modules
// lightnode (installed via npm)
//
// How to use, with all dependencies in place:
// node nodeserver.js [/path/to/the/root/folder]
@oscarrenalias
oscarrenalias / version1.bas
Created May 14, 2012 07:38
VBA Macro to change language of all texts to English
Sub LangInFrames()
scount = ActivePresentation.Slides.Count
For j = 1 To scount
fcount = ActivePresentation.Slides(j).Shapes.Count
For k = 1 To fcount
If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
ActivePresentation.Slides(j).Shapes(k).TextFrame.TextRange.LanguageID = msoLanguageIDEnglishUK
End If
Next k
Next j
@oscarrenalias
oscarrenalias / nodeproxy.js
Created October 29, 2011 11:43
A very simple Node HTTP proxy that proxies requests to the server given in the GET or POST URL. Heavily inspired by http://www.catonmat.net/http-proxy-in-nodejs/.
//
// How to use:
//
// 1. Start node:
// node nodeproxy.js
// 2. Send a URL like this:
// http://localhost:8080/http://www.google.com
//
// Watch www.google.com come through your local HTTP proxy.
//
@oscarrenalias
oscarrenalias / README.md
Last active September 27, 2020 18:46
Docker service discovery with HAproxy, consul and registrator on Docker Machine and Docker Swarm
@oscarrenalias
oscarrenalias / ehcache.xml
Created March 1, 2013 08:28
A better ehcache.xml configuration file for the Play Framework, which out of the box limits the size of the cache based on the number of objects you put in it rather than the number of bytes. I personally think that's not a very smart choice. Also see http://ehcache.org/documentation/2.5/configuration/cache-size#cache-configuration-sizing-attrib…
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<!-- This is a default configuration for 256Mb of cached data using the JVM's heap, but it must be adjusted
according to specific requirement and heap sizes -->
<defaultCache
maxBytesLocalHeap="256000000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
@oscarrenalias
oscarrenalias / gist:5504943
Created May 2, 2013 20:01
Retroarch.cfg configuration file for Retroarch in OpenELEC. Modifications to the default one: joystick settings, video and audio.
## Skeleton config file for RetroArch
# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ...
# This will be overridden by explicit command line options.
savefile_directory =/storage/.xbmc/userdata/addon_data/emulators.retroarch/save/
# Save all save states (*.state) to this directory.
# This will be overridden by explicit command line options.
savestate_directory =/storage/.xbmc/userdata/addon_data/emulators.retroarch/save/
@oscarrenalias
oscarrenalias / gist:3914875
Created October 18, 2012 21:35
Cheatsheet Play enumerators, enumeratees, iterators and iteratees
// --- cheat sheet ---
//
// Enumerator &> -> filters the output of the enumerator through an Enumeratee
// Enumerator >>> -> alias for andThen; adds the output of the second enumerator after the first one is done
// Enumerator |>> -> feeds the output of the enumerator into the given iteratee for processing
// --- end of cheat sheet ---
// Example
// Iteratee that sums up the size of the input:
@oscarrenalias
oscarrenalias / gist:1480742
Created December 15, 2011 11:12
How to check if a string is actually a number without attempting to convert it first, in Scala
//
// Compile and run:
// scalac isnumber.scala
// scala IsNumber
//
// this is the class that provides the isNumber method when called on java.lang.String
class ExtendedString(s:String) {
def isNumber: Boolean = s.matches("[+-]?\\d+.?\\d+")
}
FROM openjdk:8-jdk AS builder
RUN mkdir /src
COPY HelloWorld.java /src
RUN javac /src/HelloWorld.java
FROM openjdk:8-jre
COPY --from=builder /src/HelloWorld.class /
WORKDIR /
CMD ["java", "HelloWorld"]