Skip to content

Instantly share code, notes, and snippets.

João Ferreira Loff jfloff

Block or report user

Report or block jfloff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jfloff
jfloff / Client.java
Last active Sep 16, 2016
Intercepting Socket.getInputStream using AspectJ LTW
View Client.java
// Client: reads a string from stdin and sends it to the Server. Waits for the same message from the server.
import java.io.*;
import java.net.*;
public class Client
{
public static void main(String[] args) throws IOException
{
Socket socket = new Socket("127.0.0.1", 1234);
@jfloff
jfloff / che-electron.sh
Last active Apr 3, 2017
Script to open Eclipse Che electron app, together with the server (as docker image)
View che-electron.sh
#!/bin/sh
# check if docker is working
docker ps &> /dev/null
if [ $? -ne 0 ]; then
echo "[ERROR]\tCannot connect to the Docker daemon. Is the docker daemon running on this host?" 1>&2
return 1
fi
CONTAINER="che"
@jfloff
jfloff / latex-tips.tex
Created Jan 21, 2016
Latex Image tips
View latex-tips.tex
% 2 images side-by-side aligned bottom for IEEE
\begin{figure*}
\begin{minipage}[t]{\columnwidth}
\centering
\includegraphics[width=\linewidth]{tao}
\caption{The write path for Facebook’s replicated storage. On-path caches are synchronously updated; off-path caches are asynchronously invalidated. There is a single master region for each shard with the root-master cache and master database. Different shards may have masters in different regions. Even though (\textit{6a''}) is depicted in \cite{Lu2015,Bronson2013}, according to \cite{Fisk2013} that interation is actually done through Wormhole (\textit{6b''}). (Adapted from \cite{Lu2015,Fisk2013}) }
\label{fig:tao}
\end{minipage}\qquad
\begin{minipage}[t]{\columnwidth}
\centering
@jfloff
jfloff / mamp.md
Last active May 21, 2019
How to get MAMP to work with SSL ... Yes really.
View mamp.md

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

View gist:5020211
### Sublime Files ###
*.sublime-project
*.sublime-workspace
### OSX ###
.DS_Store
# Thumbnails
._*
@jfloff
jfloff / gist:4757426
Created Feb 11, 2013
Terminal Quickie
View gist:4757426
  • Search command history

    $ history | grep "words to search"
    
@jfloff
jfloff / sublime-text.md
Last active Dec 12, 2015
Sublime Text 2 Quickie
View sublime-text.md

Key-bindings

  • Swap lines up and down Eclipse style

    { "keys": ["alt+up"], "command": "swap_line_up" },
    { "keys": ["alt+down"], "command": "swap_line_down" }
  • Delete current line Eclipse style

@jfloff
jfloff / gist:4750950
Last active May 18, 2019
Virtual Hosts for MAMP
View gist:4750950
  1. Open hosts file:

    $ sudo subl /private/etc/hosts
    
  2. Place the following line at the end of the file:

    127.0.0.1 link
    
  3. Open MAMP's vhosts file:

@jfloff
jfloff / git-quickie.md
Last active May 30, 2017
Git Quickie
View git-quickie.md

Git commands

  • Init a git/github repo, avoiding the user/password request issue

    $ git init
    $ git add .
    $ git commit -m "Initial commit"
    # Create Github repo
    $ git remote add origin git@github.com:<username>/<repo_name>.git
    $ git push -u origin master
    
You can’t perform that action at this time.