Skip to content

Instantly share code, notes, and snippets.

Avatar

Rodrigo Fernandes rtfpessoa

View GitHub Profile
View typed-actors-routing.scala
val defaultAkkaTimeout = 60
val defaultNumberOfActors = 10
def getComponentActor[T <: AnyRef](timeout: akka.util.Timeout = Timeout(Duration(defaultAkkaTimeout, SECONDS)))(implicit m: Manifest[T]): T = {
val className = this.classCache.get(m.runtimeClass.getName)
val actorCount = defaultNumberOfActors
val actors = createRouterActors(actorCount,className,timeout)
val router = system.actorOf(Props.empty.withRouter(SmallestMailboxRouter.create(actors.toIterable.asJava)))
TypedActor(system).typedActorOf(TypedProps(Reflect(system).actorClassFor(className.get)).withTimeout(timeout), router)
@rtfpessoa
rtfpessoa / .tmux.conf
Last active Aug 29, 2015
Tmux Configuration
View .tmux.conf
# cat << ►_◄ > /dev/null
#
# Tmux config
#
# set Zsh as your default Tmux shell
set-option -g default-shell /bin/zsh
# colors please
View SimpleGestureController.java
package pt.utl.ist.cmov.bomberman.controllers;
import pt.utl.ist.cmov.bomberman.controllers.interfaces.SimpleGestureListener;
import android.app.Activity;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
public class SimpleGestureController extends SimpleOnGestureListener {
@rtfpessoa
rtfpessoa / android-studio-cleaner.sh
Created Jun 1, 2014
Script to Clean Android Studio on MacOS
View android-studio-cleaner.sh
#!/bin/sh
#
# MacOS Android Studio Cleaner
#
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
@rtfpessoa
rtfpessoa / revoke-delete.sh
Created Oct 11, 2014
Revoke delete directory permissions
View revoke-delete.sh
#
# Simple script to revoke delete permissions
#
DIRECTORY=$1
if [ "$DIRECTORY" != "" ]; then
chmod 0700 $1
chmod +a "group:everyone deny delete" $1
echo "Delete permissions revoked with success!"
@rtfpessoa
rtfpessoa / oracle-jdk-remove.sh
Created Oct 25, 2014
Oracle JDK Removal Mac OSx
View oracle-jdk-remove.sh
#!/bin/bash
#
# Oracle JDK Removal Mac OSx
#
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
@rtfpessoa
rtfpessoa / singleton.js
Created Feb 13, 2015
Simple Javascript singleton example
View singleton.js
/*
* Simple Javascript singleton example
*/
var Printer = function () {
// Object stateless code here
var counter = 0;
//counter is useless here
this.print("[" + counter++ + "] String to print!");
View .gitignore
# OSX taken from: https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
# ----------------------------------------------------------------------------------------------
.DS_Store
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Windows taken from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
@rtfpessoa
rtfpessoa / main.c
Created Apr 2, 2015
Playing with C
View main.c
#include <stdio.h>
int main(void)
{
int x = 1;
int y = 2;
int val = 5 + ( x = 3, x + y ) + 7;
printf("VAL: %d | X: %d | Y: %d", val, x, y);
@rtfpessoa
rtfpessoa / script-directory.sh
Created Apr 27, 2015
Find current script directory (shell)
View script-directory.sh
#!/bin/sh
#
# Find current script directory
#
ScriptDirectory="$( cd "$( dirname "$0" )" && pwd )"
echo "This script is currently @ $ScriptDirectory"
You can’t perform that action at this time.