Skip to content

Instantly share code, notes, and snippets.

@basinilya
basinilya / .gitattributes
Last active July 7, 2019 12:45
restart-wifi-ap.bat: Solve hostednetwork failing after sleep by restarting the physical adapter
# Auto detect text files and perform LF normalization
* text=auto
# Windows CMD does not like LF in batch files
*.bat text eol=crlf
*.cmd text eol=crlf
@basinilya
basinilya / MyLoggerFormatter.java
Last active July 27, 2019 08:27
Custom MessageFormat for java.util.logging
package org.foo.myloggerformatter;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.Format;
import java.text.MessageFormat;
import java.text.ParsePosition;
import java.util.Date;
package org.foo.jdbc2mf;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.Format;
import java.text.MessageFormat;
import java.text.ParsePosition;
import java.util.Date;
import java.util.Locale;
@basinilya
basinilya / user_conf-dave
Created May 20, 2019 16:33
Run vsftpd as regular user
# ./user_conf/dave
local_root=/home/dave/ftp
allow_writeable_chroot=YES
@basinilya
basinilya / nbgen.sh
Last active April 18, 2019 05:59
Generate Netbeans project files
NETBEANS=/opt/netbeans-8.2/bin/netbeans
fn_find_foreign_projects() {
local foreign_projects project
for project in $*; do
case " $all_projects " in
*" $project "*) : ;;
*)
if [ -f "${project}/nbproject/project.xml" ]; then
all_projects="$all_projects $project"
@basinilya
basinilya / ParametrizedTestCase.java
Last active August 25, 2018 09:01
TestTypeInference
package com.common.jsp.beans;
import java.util.Map;
import junit.framework.TestCase;
public abstract class ParametrizedTestCase<T> extends TestCase
{
public Map<Integer, T> getIncomplete()
{
@basinilya
basinilya / comread.vbs
Last active July 31, 2018 07:06
hub4com mscomm32 problem
' Usage: cscript comread.vbs n
'
' Unless the proper license is installed, the script will fail to create
' MSCOMMLib.MSComm with "Class is not licensed for use".
'
' The required Design-time license is known to be installed with:
' - Visual Studio 6 component "ActiveX"
' - TBD
Option Explicit
@basinilya
basinilya / build.xml
Created July 17, 2018 13:41
Deploy pre-built resource adapter archive as part of Enterprise Application project
<?xml version="1.0" encoding="UTF-8"?>
<project name="EnterpriseApplication1" default="default" basedir="." xmlns:ear="http://www.netbeans.org/ns/j2ee-earproject/2">
<description>Builds, tests, and runs the project EnterpriseApplication1.</description>
<import file="nbproject/build-impl.xml"/>
<!-- This fixes missing ear file before deploy outside of Netbeans -->
<target name="-init-deploy-ant" depends="dist,EnterpriseApplication1-impl.-init-deploy-ant" unless="netbeans.home">
</target>
<!-- The hook to workaround some problems during deployment -->
@basinilya
basinilya / Unsecure.java
Last active March 2, 2023 06:44
Best effort to copy everything from a secured PDF to a new PDF
package org.foo.unsecure;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.List;
import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfDictionary;
import com.itextpdf.text.pdf.PdfName;
@basinilya
basinilya / html4pod.pl
Last active June 28, 2018 10:59
adapt html for use in pod =for html paragraph
#!/usr/bin/perl
use strict;
use warnings;
use 5.008;
use Getopt::Long;
use URI;
use HTML::TreeBuilder;