ban ’em all

Ban all the attackers. Easier said than done. A website is constantly under attack as the whole server. One day I decided it was too difficult to maintain every single server and ban those attackers. Blocking IPs on the website level is too late. Also, it consumes a lot of resources. So I went for iptables. You can find it on github/JBlond/ban_em_all

DROP vs REJECT. Well, DROP is a bad option for debugging. Also, it is not the default behavior of the OS itself. Nothing is listing on a port? The OS sends a reject. Sadly I haven’t found a way to use REJECT when it comes to IPs. Using DROP on the other hand the automatic server/website scanners assume a firewall and it is more likely to continue the scan.

Add real emojis and icons to mintty bash on windows

Installing git for windows isn’t hard anymore. I recommend installing “Git for Windows SDK” so you can install extra packages via Pacman. I like fish shell and tmux, and those aren’t included in the default installer. Either way, you can run bash and or fish on windows. The emojis and icons however don’t look very pretty, more like DOS-style.

Open a shell and cd to

C:\Program Files\Git\usr\share\mintty\emojis or C:\git-sdk-64\usr\share\mintty\emojis depending what installation you chose.

cd C:\git-sdk-64\usr\share\mintty\
mkdir emojis
cd emojis
curl -LO https://raw.githubusercontent.com/wiki/mintty/mintty/getemojis
getemoji -d
getemoji .

In mintty:
Options -> Text -> Emojis -> style: google
Options -> Text -> Character set -> UTF-8

jQuery bind after ajax load

Sometimes it is needed to add a jQuery event listener to an element that isn’t present in the DOM at the creation of the page but created during runtime or the result of an ajax call.

What doesn’t work is

jQuery(document).ready(function () {
    jQuery('.selector').on({
        click: function  (event){
            event.preventDefault();
            console.log('I work only with existing elements');
        }
    });
});

However, there is a way to achieve that.

jQuery(document).ready(function () {
    jQuery(document).on('click', '.selector', function (event){
        event.preventDefault();
        console.log('I work with a dynamically created elements');
    });
});

RedDot / Opentext Language variants for page / Sprachvarianten

VBS Script

Function getAvailableLanguageVariantsForPage(callingPageGuid)
    dim XMLString
    dim resXML
    dim xmlDoc
    dim xmlNodeList
    dim i
    XMLString = "<IODATA loginguid='" & session("LoginGuid") & "' sessionkey='" & session("SessionKey") & "'>" & _
            "<PROJECT>" & _
            "<LANGUAGEVARIANTS action='pageavailable' pageguid='"&callingPageGuid&"' />" & _
            "</PROJECT>" & _
            "</IODATA>"
    resXML = objIO.ServerExecuteXml(XMLString, sError)
    Set xmlDoc = server.CreateObject( "Msxml2.DOMDocument.4.0" )
    xmlDoc.loadXML( resXML )
    Set xmlNodeList = xmlDoc.getElementsByTagName( "LANGUAGEVARIANT" )
    For i = 0 To( xmlNodeList.Length - 1 )
        strAvailableInLanguageVariant = strAvailableInLanguageVariant & xmlNodeList.Item(i).getAttribute( "guid" )
        ' strAvailableInLanguageVariantName = xmlNodeList.Item(i).getAttribute( "language" )
    Next
    Set xmlDoc = Nothing
    Set xmlNodeList = Nothing
End Function

RedDot / Opentext Render Tags Action

String Trim Kürzen

<%!! Escape:HtmlEncode(Context:CurrentIndex.Page.Elements.GetElement(hdl_headlin­e).Value.PadRight(Int:15).Substring(Int:0, Int:15).Trim().Remove(Int:1, Int:3).ToUpper().Equals(String:test).ToString().Length.ToString()) !!%>

Get file extension / Dateiendung ermitteln

<%!! Escape:Text(<%att_med_pdf_filename%>.Substring(Escape:Text(<%att_med_pdf_filename%>).LastIndexOf(.)) !!%>

Cannot load modules/mod_fcgid.so into server: undefined symbol: ap_unixd_setup_child

I got the following error message after compiling apache against the latest OpenSSL version.
Cannot load modules/mod_fcgid.so into server: undefined symbol: ap_unixd_setup_child
It looks like a compiler error that happened, but it isn’t. In fact, there are two options why there is this error message appears.
One mod_unixd isn’t loaded or loaded after mod_fcgid. Two mod_fcgid can’t create a directory for the socket or the socket itself. aka file permissions.
That error message could be much better. It is misleading. This error does not happen on Windows. It comes from the old Unix philosophy: “Everything is a file”. This lead to a ton of code in the kernels. Even more, code exists for block devices in /dev. All that symlinks and magic directories. I wonder when “Everything is a file” will have exceptions everyone agrees on.

Author Archive

Archives by Month: