Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# print base64 UUIDs on command line as LDAP search filter of the form:
# (|(ObjectGuid=\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx)...)
fn_base64_uuid_to_hexarray() {
# hexdump base64 valie in $2 to a new indexed array of hex values and name the array $1
# declare global array, not assigning a value for 2 reasons:
# - command substitution exit code would be discarded
# - declaring arrays with variable name require quoting the right side: $n='(1 2 3)'
@basinilya
basinilya / mxmoduleclean
Last active February 6, 2024 16:18
mxmoduleclean
#!/bin/bash
#
# delete *.Required* marker files belonging to a Mendix module and delete their
# *.jar files unused by other modules
#
# Usage:
# cd userlib
# # delete module:
# mxmoduleclean MODULE
# # delete everything except MODULE
@basinilya
basinilya / hugebuf.sh
Last active October 28, 2024 19:12
https://stackoverflow.com/q/68469752/447503 svnsync cannot recover from source idle disconnect
#!/bin/bash
# usage:
# socat TCP-LISTEN:3128,reuseaddr,fork EXEC:"./hugebuf.sh -p",nofork
set -e
proxymode=
case $1 in
package org.foo.chainedlist;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
import org.apache.commons.collections4.IterableUtils;
/// disable-pageview-api.js
// Based on: https://addons.mozilla.org/firefox/addon/disable-page-visibility/
// License: http://www.opensource.org/licenses/bsd-license.php
(function(){
// visibilitychange events are captured and stopped
document.addEventListener("visibilitychange", function(e) {
e.stopImmediatePropagation();
}, true);
// document.visibilityState always returns false
Object.defineProperty(Document.prototype, "hidden", {
#!/bin/bash
# Check if the current time falls within defined time range on UNIX
#set -e
set -o pipefail
function errtrap { es=$?; echo "ERROR line $1: Command exited with status $es.">&2; exit 1; }; trap 'errtrap $LINENO' ERR
#export TZ=Asia/Kolkata
@basinilya
basinilya / Modulegen.java
Created February 8, 2020 10:48
Generate jboss-cli "module add" command for a jar with recursive Class-Path dependencies
package org.foo.modulegen;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
package org.foo.testproxy;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class EclipseExtractConstant {
private static final int _42 = 42;
private static final String STRING€WITH_SPECIAL_CHARACTERS = "string€with%special†characters/\\!";
private static final String _100STRINGSSTARTSWITHNUMBER = "100stringsstartswithnumber";
private static final String STRING_WITH_SPACES = "string with spaces";
public static void main(final String[] args) {
System.out.println(x(STRING€WITH_SPECIAL_CHARACTERS));
System.out.println(x(_100STRINGSSTARTSWITHNUMBER));
package org.foo.csvtokenizer;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractPushingCsvParser implements PushingCsvParser {
@Override