Skip to content

Instantly share code, notes, and snippets.

Jonathan Welzel jnwelzel

Block or report user

Report or block jnwelzel

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
View Kb.java
// 2MB
if (picture.length > 2 * 1024 * 1024) {
throw new FDNFileTooLargeException("2MB.");
}
@jnwelzel
jnwelzel / recursive-delete-file-type-in-linux.md
Created Feb 27, 2014
recursive-delete-file-type-in-linux
View recursive-delete-file-type-in-linux.md

#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 Mar 7, 2014
Workaround for starting Derby network server under JDK 7_u51 and its new security policies
View derby_u51_workaround.md
  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
View update-jersey-in-gf.sh
#!/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() {
View OAuthRequestValidator.java
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 {
@jnwelzel
jnwelzel / backbone_mixin.js
Created Jun 6, 2014
Backbone mixin for enabling Reactjs components to respond to Backbone objects/collections changes
View backbone_mixin.js
// An example generic Mixin that you can add to any component that should react
// to changes in a Backbone component. The use cases we've identified thus far
// are for Collections -- since they trigger a change event whenever any of
// their constituent items are changed there's no need to reconcile for regular
// models. One caveat: this relies on getBackboneModels() to always return the
// same model instances throughout the lifecycle of the component. If you're
// using this mixin correctly (it should be near the top of your component
// hierarchy) this should not be an issue.
var BackboneMixin = {
componentDidMount: function() {
View ux_restore.sh
#!/bin/bash
#
# Description:
# this script restores couchbase & neo4j from the UX reference server, e.g qa1b.
# the process for restoring this is as follows:
# - start Couchbase and stop neo4j (with neo4j_server_stop.sh)
# - download the latest backup from http://10.165.4.67/fluigidentity.database.backup.tar.gz
# - run this script as "sudo ux_restore.sh <DB_ARCHIVE_ZIP> [<CLOUDPASS_HOME_DIR>]"
# - start neo4 (with neo4j_server_start.sh)
# - hit localhost:7474/browser and confirm that DB size is apprx 32gb by clicking the circles in the top-left corner
View error.txt
[26 Feb 2015;12:30:47.562] - [WARN ] [UserServiceInterfaceImpl:1074] - Failed to associateUser java.lang.NullPointerException: null
at com.totvslabs.idm.db.services.DBUserServiceImpl.associateUser(DBUserServiceImpl.java:924)
at com.totvslabs.idm.rmi.service.impl.UserServiceInterfaceImpl.associateUserInternal(UserServiceInterfaceImpl.java:1049)
at com.totvslabs.idm.rmi.service.impl.UserServiceInterfaceImpl.associateUser(UserServiceInterfaceImpl.java:1030)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$2.run(Transport.java:202)
View websocket-server.js
/**
* Using https://github.com/websockets/ws
*/
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({port: 8080});
wss.on('connection', function(ws) {
ws.on('message', function(message) {
wss.broadcast(message);
@jnwelzel
jnwelzel / conhecimento_transporte.rb
Created Jul 23, 2012
Super classe usada no projeto CT-e para definir um objeto que possa ser tanto persistido como serializado para XML
View conhecimento_transporte.rb
# encoding: utf-8
class EntidadeCte
include Mongoid::Document
include ROXML
class << self
# apelida o xml_accessor do ROXML para cte_attr
# alias :cte_attr :xml_accessor
You can’t perform that action at this time.