Skip to content

Instantly share code, notes, and snippets.

@khsthomas
khsthomas / FormView.java
Created April 20, 2020 02:06 — forked from afsinka/FormView.java
Show PDF Files With PrimeFaces
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
@khsthomas
khsthomas / mega-backup
Created December 28, 2019 03:01 — forked from Scarsz/mega-backup
crontab-able nightly backup to mega.nz via megatools
#!/bin/bash
locationstocompress=( "/home" "/var/www" )
identifier="WEB-1"
megaemail="email@provider.com"
megapass="password"
# Edit below this if you're feeling lucky
masterfile="$identifier-$(date +"%Y-%m-%d").tar.gz"
@khsthomas
khsthomas / glassfish-3.1.1.sh
Last active December 12, 2019 07:01 — forked from arlukin/glassfish-3.1.1.sh
Startup (/etc/init.d/glassfish) script for Glassfish 3.1 on Centos 6.
#!/bin/bash
# Startup script for Glassfish.
#
# chkconfig: 2345 95 05
# description: Start the java application server, glassfish.
# pidfile: /var/run/glassfish.pid
#
# Used and tested on centos 6
#
# Author: daniel.lindh@fareoffice.com
@khsthomas
khsthomas / CORSContainerResponseFilter.java
Created August 22, 2019 08:51 — forked from mrserverless/CORSContainerResponseFilter.java
Jersey ContainerResponseFilter example of CORS Filter. The Jetty version is more comprehensive: https://gist.github.com/yunspace/07d80a9ac32901f1e149
import javax.inject.Singleton;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.Provider;
import java.io.IOException;
@Singleton
@Provider
@khsthomas
khsthomas / HelperResource.java
Created August 21, 2019 09:58 — forked from bowenwr/HelperResource.java
Jersey Pagination Example for Jersey Mailing List Request
public class HelperResource {
public static void setRequestOptions(ContainerRequestContext requestContext, RequestOptions requestOptions) {
requestContext.setProperty("requestOptions", requestOptions);
}
public static boolean isBodyRequested(ContainerRequestContext requestContext) {
// Do not return a body for head methods, but we might want to calculate paging / headers, etc.
// For now this is getting rewritten as GET by Jersey, but it might be changed later:
// https://java.net/jira/browse/JERSEY-2460
@khsthomas
khsthomas / BookPersister.java
Created August 21, 2019 07:22 — forked from bernardolopes8/BookPersister.java
Jersey Pagination, Sorting, and Filtering Example
package my.application.dao;
import java.util.List;
import my.application.entity.Book;
import my.application.restutil.RequestOptions;
public interface BookPersister {
List<Book> getBooks(RequestOptions requestOptions);
}
@khsthomas
khsthomas / sass-convert_from-sass-to-scss.sh
Created April 29, 2018 10:09 — forked from uran1980/sass-convert_from-sass-to-scss.sh
Convert .sass syntax to .scss in terminal
# http://blog.teamtreehouse.com/the-absolute-beginners-guide-to-sass
# Enter the folder you want to convert in your terminal and type in:
# ---------------------------------------------------------------------
# sudo apt get install ruby-sass
# ---------------------------------------------------------------------
sass-convert --from sass --to scss -R .
# where -R means recursively and . means the current directory.
@khsthomas
khsthomas / build-chromium-windows.bat
Created January 12, 2018 08:52 — forked from apla/build-chromium-windows.bat
Build CEF# from source with mp4
@echo off
REM instructions from: https://groups.google.com/d/msg/cefsharp/BJLMXl9c204/HMJlp8mZzF0J
REM seems like partial instructions copied to SO: http://stackoverflow.com/questions/8033495/chromium-embedded-framework-mp3-support
REM all chromium releases: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md#markdown-header-release-branches
REM 2272 - latest chromium with npapi (41)
REM there is a commits list: https://bitbucket.org/chromiumembedded/cef/branch/2272
REM https://github.com/cefsharp/CefSharp
REM cef builds http://www.magpcss.net/cef_downloads/
REM https://cefbuilds.com