Skip to content

Instantly share code, notes, and snippets.

@jGleitz
jGleitz / EntityAccessorBug.go
Last active September 19, 2016 10:43
The code below does not use myReaderWriter vor Accept: */* requests. See https://github.com/emicklei/go-restful/issues/309
package main
import (
"github.com/emicklei/go-restful"
"net/http"
"io"
"log"
"os"
)
@jGleitz
jGleitz / Openineeclipse.md
Last active February 7, 2016 13:10
[Instructions] URL Handler for opening Eclipse

This will explain how to register a custom url handler to open files in Eclipse at a specific line number on Linux. After performing these instructions, you will be able to open urls of the form

openineclipse://open?url=$path-to-file?line=$linenumber

The instructions were tested on Ubuntu 15.10 but should work on most Gnome based distributions.

  1. Install xdotool
@jGleitz
jGleitz / open-in-eclipse.desktop
Created February 7, 2016 13:04
[Desktop file] URL Handler for opening Eclipse
[Desktop Entry]
Name=Open File at Line Number in Eclipse
Type=Application
Exec=/home/you/.scripts/open-in-eclipse-pse.sh %u
Terminal=false
Icon=eclipse
Comment=Integrated Development Environment
NoDisplay=true
Categories=Development;IDE
Mime-Type=x-scheme-handler/openineclipse;
@jGleitz
jGleitz / open-in-eclipse.sh
Last active February 7, 2016 13:02
[Shell script] URL Handler for opening Eclipse
#!/bin/bash
###################################################################
# CONFIGURATION #
# #
# Please adapt the lines below to match your Eclipse installation #
###################################################################
# Path to the eclipse executable to launch
ECLIPSE="/opt/eclipse/eclipse"
@jGleitz
jGleitz / mark-character-in-file.sh
Last active February 11, 2016 10:34
Bash: Mark character in file
function markchar {
inputfile=$1
charcount=$2
filecontent=`cat $inputfile`
firstpart=`printf "${filecontent:0:$charcount}" | tail -n5 | sed 's/\t/ /g'; printf "e"`
firstpart="${firstpart%e}"
char="${filecontent:$charcount:1}"
lastpart=`printf "${filecontent:$((charcount + 1))}" | head -n5 | sed 's/\t/ /g'`
red='\033[0;31m'
redbg='\033[41m'
@jGleitz
jGleitz / binding.gyp
Created August 19, 2015 19:07
Working binding.gyp for brackets-sass
{
'targets': [
{
'target_name': 'binding',
'win_delay_load_hook': 'true',
'sources': [
'src/binding.cpp',
'src/create_string.cpp',
'src/custom_function_bridge.cpp',
'src/custom_importer_bridge.cpp',
@jGleitz
jGleitz / ScannerPrintDelim.java
Last active January 20, 2016 15:57
Java: Scanner printing the delimiters
public class ScannerPrintDelim {
public static void main(String[] args) {
String test = "(Hallo) (Welt)";
Scanner scanner = new Scanner(test);
scanner.useDelimiter(or(withDelim("\\("), withDelim("\\)")));
while (scanner.hasNext()) {
System.out.println(scanner.next());
}
scanner.close();