Skip to content

Instantly share code, notes, and snippets.

@NKjoep
NKjoep / backup-japs.sh
Created March 18, 2011 13:10
This script will backup both your PostgreSQL databases of your jAPS Entando application.
#!/bin/bash
## Title: backup-japs.sh
#
## Description: This script will backup both your PostgreSQL databases of your jAPS Entando application.
## Will write in the current directoy two files: 2010-03-18-1406_PortalExamplePort.backup, 2010-03-18-1406_PortalExampleServ.backup
#
## Usage: backup-japs.sh host port username password project
## Example: backup-japs.sh localhost 5432 agile mypassword PortalExample
#
#
@NKjoep
NKjoep / fast-renamer.sh
Created March 18, 2011 15:09
This simple bash script will rename all the files in the current directory: all lowercase, spaces to _ , minus - to _
#!/bin/bash
rename 'y/A-Z/a-z/' *
rename 'y/ /_/' *
rename 'y/-/_/' *
@NKjoep
NKjoep / google-chrome-nocache.sh
Created March 22, 2011 13:48
Launch Google Chrome with cache disable
#!/bin/bash
## Description: Launch Google Chrome with cache disable
## Author: Andrea D. <nkjoep@gmail.com>
#
## Remember to change the path :)
/usr/bin/google-chrome %U --disk-cache-size=1 --media-cache-size=1
@NKjoep
NKjoep / current_jsp_path_filename.jsp
Created March 25, 2011 12:04
This will print out the full path of the executed JSP
This JSP is placed:
<%=getServletConfig().getServletContext().getRealPath(request.getServletPath())%>
@NKjoep
NKjoep / console.log.reg
Created May 6, 2011 10:06
Fast RegExp which find and replace all console.log( occurences in your code and comment them out.
//find this
(^.*[^//])console.log
//replace with
$1//console.log
@NKjoep
NKjoep / entando-headinfo-jsp-fragment.jsp
Created September 15, 2011 14:01
Entando Pagemodel Headinfo
<%@ taglib prefix="wp" uri="aps-core.tld" %>
<%-- css --%>
<wp:outputHeadInfo type="CSS">
<link rel="stylesheet" type="text/css" href="<wp:cssURL /><wp:printHeadInfo />" />
</wp:outputHeadInfo>
<%-- css for ie7 --%>
<wp:outputHeadInfo type="CSS_IE7">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<wp:cssURL /><wp:printHeadInfo />" />
@NKjoep
NKjoep / adminadmin-scriptlet.js
Created March 7, 2012 14:12
browser scriptlet for quick adminadminamdin
javascript:(function(){var%20inputs%20=%20document.getElementsByTagName("input");%20for%20(var%20i%20=%200;i<inputs.length;i++)%20{%20var%20c%20=%20inputs[i];%20if%20(c.name=="username")%20c.value%20=%20"admin";%20if%20(c.name=="password")%20c.value%20=%20"adminadmin";%20}%20})();
@NKjoep
NKjoep / jsp-javascript-escape-sample.jsp
Last active November 18, 2015 22:15
JSP javascript escape with JSTL
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%-- setup --%>
<% pageContext.setAttribute("carriageReturn", "\r"); %>
<% pageContext.setAttribute("newLine", "\n"); %>
<c:set var="singleQuotes">'</c:set>
<c:set var="singleQuotesReplace">\'</c:set>
<c:set var="doubleQuotes">"</c:set>
<c:set var="doubleQuotesReplace">\"</c:set>
@NKjoep
NKjoep / Entando-wp18n.sublime-snippet
Created November 8, 2012 09:41
Sublime Text 2 Snippets Collection
<snippet>
<content><![CDATA[
-- DELETE FROM localstrings where keycode = '${1:keycode}';
INSERT INTO localstrings(keycode, langcode, stringvalue) VALUES ('${1:keycode}','en','${2:en_value}');
INSERT INTO localstrings(keycode, langcode, stringvalue) VALUES ('${1:keycode}','it','${3:it_value}');
-- <wp:i18n key="${1:keycode}" escapeXml="true" />
${4}
]]></content>
</snippet>
@NKjoep
NKjoep / .bash_profile
Last active May 14, 2021 20:45
My .bash_profile
# Various variables you might want for your PS1 prompt instead
#Time12h="\T"
#Time12a="\@"
PathShort="\w"
#PathFull="\W"
#NewLine="\n"
Jobs="\j"
# Git
source /etc/git-completion.bash