Skip to content

Instantly share code, notes, and snippets.

/**
* Servlet filter that checks all request parameters for potential XSS attacks.
* see http://bazageous.com/2011/04/14/preventing-xss-attacks-with-antisamy/
*
* @author barry pitman
* @since 2011/04/12 5:13 PM
*/
public class AntiSamyFilter implements Filter {
private static final Logger LOG = Logger.getLogger(AntiSamyFilter.class);
@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@NickNaso
NickNaso / proxy.js
Last active January 25, 2023 18:40
Log or modify the request body in the node-http-proxy before to pass it to the express.js application
/*******************************************************************************
* Copyright (c) 2017 Nicola Del Gobbo
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the license at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
* IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
* MERCHANTABLITY OR NON-INFRINGEMENT.
@int128
int128 / README.md
Last active January 21, 2024 14:52
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@vestjoe
vestjoe / random_file_generator.py
Last active March 10, 2024 19:57
Generate valid random files
# Random file generator
# This tool generates random valid files of various types using real data based on Loreum Ipsum. Files are created in a custom directory structure.
# Generates random files based on Lorem Ipsum text
# Generates random file names from word list
# Generate valid files of type: txt, docx, xlsx, pptx, xml, config
# Requirements
# On windows download and install lxml manually: https://pypi.python.org/pypi/lxml/3.4.4
'''