Skip to content

Instantly share code, notes, and snippets.

View sohlich's full-sized avatar
🏠
Working from home

Rado Sohlich sohlich

🏠
Working from home
View GitHub Profile
// Creates a new serve mux
mux := http.NewServeMux()
// Create room for static files serving
mux.Handle("/node_modules/", http.StripPrefix("/node_modules", http.FileServer(http.Dir("./node_modules"))))
mux.Handle("/html/", http.StripPrefix("/html", http.FileServer(http.Dir("./html"))))
mux.Handle("/js/", http.StripPrefix("/js", http.FileServer(http.Dir("./js"))))
mux.Handle("/ts/", http.StripPrefix("/ts", http.FileServer(http.Dir("./ts"))))
mux.Handle("/css/", http.StripPrefix("/css", http.FileServer(http.Dir("./css"))))
@sohlich
sohlich / JavaFXTrayIconSample.java
Created December 3, 2016 19:04 — forked from jewelsea/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
@sohlich
sohlich / parsers_test.go
Created November 18, 2016 05:32
Golang program argument testing
func TestConfigParse(t *testing.T) {
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
os.Args = []string{"metro",
"-host=localhost",
"-port=30",
"-user=ssh",
"-password=sshpass",
"-list=lst.csv",
"-timeout=25"}
@sohlich
sohlich / sshtunnel.go
Created November 12, 2016 05:04 — forked from iamralch/sshtunnel.go
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@sohlich
sohlich / ssl_smtp_example.go
Created September 15, 2016 03:06 — forked from chrisgillis/ssl_smtp_example.go
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@sohlich
sohlich / persistence.xml
Created August 6, 2016 18:30 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@sohlich
sohlich / shiro.ini
Created August 6, 2016 10:44 — forked from dominicfarr/shiro.ini
example jdbcRealm configured in shiro.ini
[main]
ds = com.mysql.jdbc.Driver
ds.serverName = localhost
ds.user = user
ds.password = password
ds.databaseName = db_name
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.dataSource = $ds
jdbcRealm.permissionsLookupEnabled = true
^[a-z]{4}:/{2}[a-z]{0,3}\.?[a-z,0-9,\.]{1,}\.?[a-z]{0,}:?[0-9]{0,4}
@sohlich
sohlich / Wildfly: deployment-overlay
Created January 8, 2016 11:56
Wildfly CLI: The deployment overlay command
deployment-overlay add --name=myOverlay --content=/WEB-INF/web.xml=/myFiles/myWeb.xml,/WEB-INF/ejb-jar.xml=/myFiles/myEjbJar.xml --deployments=test.war,*-admin.war --redeploy-affected
@sohlich
sohlich / Makefile.golang
Last active November 6, 2016 05:24 — forked from dnishimura/Makefile.golang
Makefile for Golang projects
BUILDPATH=$(CURDIR)
GO=$(shell which go)
GOBUILD=$(GO) build
GOCLEAN=$(GO) clean
GOGET=$(GO) get
EXENAME=main
export GOPATH=$(CURDIR)