Skip to content

Instantly share code, notes, and snippets.

View jnwelzel's full-sized avatar
💻
[object Object]

Jonathan Welzel jnwelzel

💻
[object Object]
View GitHub Profile
@jnwelzel
jnwelzel / vlc_red_hat.md
Last active January 2, 2016 12:19
How to install VLC Media Player on Red Hat

Installing VLC Media Player on Red Hat

My Red Hat version: 6.5 (Santiago)
My architecture: x86_64

  1. Head over to http://rpmfusion.org/Configuration, download the RPM and install it. This will end up enabling the RPM Fusion repo on your machine. Later you can disable it if you prefer by editing the corresponding *.repo file inside the /etc/yum.repos.d/ directory. This might avoid unecessary conflicts later on.
  2. Now to install VLC open up your terminal and use $ sudo yum install vlc.x86_64 (you might have to update yum repos first, not sure).

That's it!

@jnwelzel
jnwelzel / perguntas_empresa.md
Last active January 2, 2016 15:08
Perguntas a serem feitas pelo funcionário na hora da contratação que lá na frente podem evitar dores de cabeça.
  1. Vou ter que abrir outra conta bancária só pra receber o salário de vocês?
  2. Empresa dispõe de estacionamento coberto? Pra mim, que tenho moto, isso é essencial.
  3. Se não quiserem te dar tempo pra pensar na proposta e ficarem tentando te forçar a dar logo uma resposta se vai aceitar o cargo ou não, tome cuidado porque essa empresa provavelmente é ejaculação precoce e vai botar pressão p caramba. Esteja ciente disso.
@jnwelzel
jnwelzel / Bean.java
Last active February 8, 2024 21:56
Simple generic DAO structure for Java. Note that the interface takes two generic parameters, one for the primary key type, and the second for the bean type, which uses the same primary key. This enables you to use any kind of object as a primary key, making your code very flexible. This is a good behavior especially if you use JPA embedded ids (…
@MappedSuperclass
public abstract class Bean<PK extends Serializable> implements Serializable {
private static final long serialVersionUID = 1L;
@Version
@Column(name = "VERSION", nullable = false)
private Long version;
public Bean(PK id, Long version) {
@jnwelzel
jnwelzel / maven_snippets.md
Last active January 4, 2016 10:29
Maven snippets

####Local archetype Execute this inside your archetype project $ mvn install archetype:update-local-catalog. After that, create a new project using the newly installed archetype by using $ mvn archetype:generate -DarchetypeCatalog=local, choose the archetype number corresponding to the one you just installed and follow the on screen instructions. Here's a good example of an archetype to get you started.

@jnwelzel
jnwelzel / Kb.java
Created February 27, 2014 17:01
wow
// 2MB
if (picture.length > 2 * 1024 * 1024) {
throw new FDNFileTooLargeException("2MB.");
}
@jnwelzel
jnwelzel / recursive-delete-file-type-in-linux.md
Created February 27, 2014 18:14
recursive-delete-file-type-in-linux

#First "cd" to the top directory you want to start in. (Don't be stupid and run this from your root....)

To get a confirmation for every file use: find . -type f -name "*.bak" -exec rm -i {} \;

Or if you're feeling confident use: find . -type f -name "*.bak" -exec rm -f {} \;

@jnwelzel
jnwelzel / derby_u51_workaround.md
Created March 7, 2014 14:20
Workaround for starting Derby network server under JDK 7_u51 and its new security policies
  1. Grab the policy file here
  2. Use the following command $ java -Djava.security.manager -Djava.security.policy=/home/jwelzel/Downloads/1010_server.policy -Dderby.security.port=1527 -Dderby.install.url=file:/home/jwelzel/apps/db-derby-10.10.1.1-bin/lib/ -cp "lib/*" org.apache.derby.drda.NetworkServerControl start
@jnwelzel
jnwelzel / GsonProvider.java
Created March 10, 2014 14:36 — forked from hstaudacher/GsonProvider.java
Integrating Gson into a JAX-RS application to replace the other shitty default providers
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
#!/bin/bash
JERSEY_VERSION=2.7
HK2_VERSION=2.3.0-b03
JAVASSIST_VERSION=3.18.1-GA
MODULES_DIR=`pwd`/modules
OSGI_CACHE_DIR=`pwd`/domains/domain1/osgi-cache/felix
processArtifact() {
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Verb;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import branda.media.exception.CacheException;
public class OAuthRequestValidator {