blog.darkstar.work - a simple url encoder/decoder

 a simple url encoder/decoder
 http://blog.darkstar.work

Labels

Wirtschaft (152) Pressefreiheit (131) Österreich (123) IT (98) code (62) Staatsschulden (37) EZB (27) Pensionssystem (16)

2023-11-24

old & simple social liberal slogans

If you sell as a large supplier products in the cheaper segment , then it makes sense to employ people from a minority group, because with them in your sales or marketing team, you can also reach this segment of the market surley with great customer binding.

Remember that it is easier to integrate minorities in that smart liberal way, instead of forcing it by law. (Otherwise Republican party GOP and right wing parties will fury.)
Notice that minority groups often are only interested in large robust standard products inside the cheaper segement, because of income weakness as result of fewer chances and discrimination.

Sometimes humanistic or public moderate spending is labeled as 'High ugly costs'.


When people thought HP-UX, AIX, SCO Unix Group, Solaris or high end IRIX
will make the race,
then notice that now SGI IRIX XFS is availible under linux now,
that IBM's JFS is even longer part of the linux kernel,
that Sun's ZFS was ported to linux from 2005 - 2010,
as availible alternative to pure GNU filesystems Btrfs or elder ext4.


If an aggressive renegotiation of a service brings both social responsibility and shareholder value (in sense of price reducement or qualitity improvement), then that's good.


Spending money for education, children rights and fair play might not be optimally offset in your tax return, but it will give you a brilliant image and avoid problems in future.


Investing money in education and skills in next generation, probably has a very late return on investment.


2023-11-16

Warn signals for liberal democracies?

2005 prolog

Most of you know Georg Lucas and Star Wars.

In star wars episode III - "revenge of the sith" (produced 2005) 
jar jar propose that the senate give emergency power to ...



2020 warn signals for liberal democracies?

There are fewer liberal democracies than there were 10-15 years ago.

Some countries, that were choosed the way to liberal democracy some year ago, returned now to a more authoritarian style.

German public-service television network ARD's 'Tagesschau' titled one year ago:
Tunisia's President Saied
On the way to becoming a dictator?

Tunisia's President Saied is voting on a new constitution that would give him comprehensive rights. Is the president, who has already disempowered the government and parliament, on the way to becoming a dictator?

Reasons for reducement of democratic institutions

1. Democracy costs money, is expensive
If the economic situation is bad and debts and unemployment rise, then savings are often made in some areas of the state sector.
Unfortunately, only a few states process government shutdown procedures. where all except most necessary government spendings are reduced, unless a new budget is democratically decided.
Governments often save money where it affects only a few and the few have a weak lobby or no lobby at all.
  • NGOs regularly have their budgets cuts

    For churches and a small group of state authorized charity you can spend money and pay less tax,
    but for a lot of other NGO's, specifically free churches (like the taxas christ chuch, baptist church, knights templar society or hindu temple), gnu opensource group, ieft, civil right movements, LGBT communities, free artists associations you don't get 1 penny of tax facilitation / reducement, when spendig a lot.

    So most NGO are dependent on crowed founding and small subvenetions from the state, 
    some special state legitimated NGOs have privileges, that spending will cause tax reduction and a minimum of state budget is reserved for them.
    e.g. I spended also only for caritas socialis & Volkshilfe, when earning good, because of tax cuts.
    p.s. I really coulded to reduce my tax bill even more, but I didn't it in case of investation in car, books, membership for liberal party or investments for the children and wrote every income postion on my tax declaration.

    Financal support for free pressed were limited for public TV, you had to pay a special GIS tax, but there is no posibility to spend money to the free press pod neither for companies nor private persons.
  • Invalidity pensions were abolished

    In some areas, state welfare is limited to incapacitated people (without full citizens and human rights). Former finance ministress Maria Theresia Fekter critized in year 2013, that too many healthy people retire at average age of 52-53. https://www.youtube.com/watch?v=omb-jdmy_nw&t=65s
    Now even very sick people stay at 56 fully in labor market,
    but I'm so proud that we all will retire later.

  • Homeless shelters cost €200 - €300 per month.

    (I remember, my Frank pointed out to me in year 2000 that in Asia homeless shelters are not free like here and cost US$5 per night and thought, that such things will never become popular in Europe or legitimated. Well since ~2014 that changed.)
2. Democratic and state processes are sometimes inefficient, slow and bureaucratic

'Many democratic processes, especially court proceedings, legitimation for new rather unknown business licenses and environmental impact assessments, are often bureaucratic, take a lot of time. In order to speed up these processes, things were simplified and appeal options were limited in trys and short time period.
For example the Austrian police 
  1. revoked me my driving license for one year and after obtaining it back, the license is limited to year 2025 and I have to proove a certificate of a psycolical investigation every ¼ year (3 months)

  2. imposed a general weapons ban on me 

3. State must also guarantee international competition, and when cut spending, than it had to reduce taxes for companies and workers

Well in US and other countries both parties (democrats and republicans) often promise big fat tax cuts  (maybe with icecream) for companies and workers and sometimes hope, that the good old blue colar worker jobs will come back to the US. Here in Austria, the state seem to reduce spending for some groups, but didn't promise any big fat tax or social insurence cuts at all.

Well, I was able to achieve a big fat cut from social insurance, when I worked for a community based project where all profits were donated to cancer aid and then only reached a maximum of €2000 before taxes per year for the period of 1-2 years.

I am currently unemployed since September 2023 and receive too much money for doing nothing and that only because a have to pay for two children and my ex-wife has too little income. I feel so ashamed for that, that I have already initiated the reopening of my small company after X-Mas on January 1st, 2024 in new lulz.

2023-10-25

E-Mobilität? China hats schon, die USA baute Tesla und Europa fällt auch hier zurück

Es gibt in Österreich keinen Porsche Cayenne Mangel


Porsche Cayenna auf gebrauchtwagen.at (319 Porsche Cayenne sofort verfügbar)


Porsche Cayenna auf willhaben.at (432Porsche Cayenne sofort verfügbar)





Öl- und Benzin-Preise sind zwar noch billig genug, trotzdem wird inzwischen die E-Mobilität in Europa stiefväterlich behandelt, wahrscheinlich liegt es am SUV Überschuss im Markt.

Auf Alibaba boomt das Elektro-Automobil




Some new chinese electro car models::

Neta X



2023 Byd Seagull Haiou





2023-10-22

Case study of apparently sowiet (U.S.S.R.) tactical advantages during cold war (20th century)

After world war II the so called cold war between USA vs. USSR dominated farly political and geostrategic focus. 
This article focuses on Soviet tactical and strategic advantages.
But I ask you to carefully consider the impact of the US backlashes,
which I intentionally don't emphasized.

Phase I: Division of states

For the Soviets, the division of states was an ideal instrument of direct pressure on allies of the US.
I would call it "far near fear". The far fear of communism and a global conflict became sometimes very near. 
Sovjets forced USA to react to their actions, see Berlin Blockade  
Speach of JKF in West Berlin: Ich bin ein Berliner.

Germany

BRD vs. DDR
    Source: geschichte-abitur.de


Korea


Source: Wikimedia

Sputnik Crisis: Demonstrating technological advantage

Source: https://de.wikipedia.org/wiki/Sputnikschock#/media/Datei:Sputnik-stamp-ussr.jpg
Sputnik crisis was a symbolic act to demonstrate the advantage of USSR in space technology. Many people only remember the creation of NASA as countermeasure, but mostley forget another;Founding of DARPA (Defense Advanced Research Projects Agency) who emerged ARPANET, origin of entire internet today.

Cuba Crisis: Ability to critically hit an unshielded opponent 

The cuba crisis seemed to be first a tatical victory for the Sovjets. Deployment of short and medium ranged missiles on Cuba seemed like a total tactical advantage over the USA. (Counterstriking the enemy critically, even in case of first strike by US.)
Screenshot of Google Maps

An effictive blockade of Cuba and great skills of JFK neutralized  tactical superiority of USSR so far. US agreed to dismantle Jupiter nuclear missiles from Turkey:


Counter measures against civil protests: Tanks, tanks, tanks

Tanks (Hungarian Revolution 1956), tanks (Prague Spring) and tanks (? guess who and where)?
Source: https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/J%C3%B3zsef_k%C3%B6r%C3%BAt_a_Corvin_%28Kisfaludy%29_k%C3%B6zn%C3%A9l._Harck%C3%A9ptelenn%C3%A9_tett_ISU-152-es_szovjet_rohaml%C3%B6vegek%2C_a_h%C3%A1tt%C3%A9rben_egy_T-34-85_harckocsi._Fortepan_24854.jpg/330px-J%C3%B3zsef_k%C3%B6r%C3%BAt_a_Corvin_%28Kisfaludy%29_k%C3%B6zn%C3%A9l._Harck%C3%A9ptelenn%C3%A9_tett_ISU-152-es_szovjet_rohaml%C3%B6vegek%2C_a_h%C3%A1tt%C3%A9rben_egy_T-34-85_harckocsi._Fortepan_24854.jpg
 

Tanks in russian capital Moscow for coup d'etat

Last time I remember tanks in capital moscow occured 1991 during Soviet coup d'etat attempt.
Source: Wikimedia

Outlook in 21st century

Danger of Soviet block doesn't exist anymore in the old manner of cold war in 21st century, but I 've an intense feeling that a stable multilateral new world order was not created  out of a fair process within national constituted assemblies. The expectation that liberal democracies and global corporations would have been a possible future seems less possible than it 10-20 years ago.

2023-10-17

Erfahrungsbericht zur Psychiatrie, Psychotherapie, angewandten Psychologie und psychosozialen Diensten

Laien in der Psychologie, wie ich, sahen durch sehr viel Erfahrung mit Neurolgie, Psychatrie, Psychologen und Psychotherapeuten folgenden Ausschnitt im Spektrum des psychischen Gesundheitsbehandlung.

1. Psychiatrie

1.1. geschlossene Abteilung der Psychiatrie


In der geschlossenen Abteilung der Psychatrie werden Patienten zu 90% durch Psychopharmaka sediert | ruhig gestellt, dürfen die geschlossene Station nicht verlassen. 
Möglicherweise wird der Zugriff auf das Smartphones eingeschränkt, bzw. Laden des Smartphone nur durch Nachschwestern | Nachtpfleger auf deren Station ermöglicht. 
In manchen Fällen gelten Patienten auf der geschlossenen Station rechlich als nicht mündig | entscheidungsfähig | geschäftsfähig.
(Dies kann zu Problemen für, wenn jemand mit seinem Smartphone und der ID Austria signiert oder rechtlich bindende Verträge als Privatperson [Mobilfunk Tarifwechsel] oder als Einzelunternehmer [Vereinbarung zum Aufschub eines Werkvertrags | einer Werksarbeit ] tätigt.)
Falls der Einweisung einen Gesetzesbruch voranging (Ruhestörung, nicht gefährliche Drohung, leichte Körperverletzung) von einem Schnellrichter zu einer Verhandlung geladen, zwecks weiterer das ganze Leben betreffender Maßnahmen. Schnellrichter sind daher äußerst milde, wenn eine Person partout nicht sehr lange in eine geschlossenen Abteilung ihr Dasein fristen will oder wenn Betrugsfälle durch Wegfall dieser Person im öffentlichen, wirtschaftlichen oder sozialen Leben zu erwarten sind. (Beispiel: Wichtiges Mitglied im Aufsichtsrat, Ikone für LGBT, Privatier und Erbe, Antifaschist, wichtig für den chinesischen Tourismus in Österreich, letzte echte Wiener.Hausmeisterin im Gemeindebau oder letzter existierender Nachtportier des Nationalbank, jetzt föderale Österreich Euroreservebank)

1.2. offene Abteilung der Psychiatrie

In der offenen Abteilung der Psychatrie wird die Medikation von Psychopharmaka meist reduziert und je nach Klinik Ausgang in den Garten oder in die nähere Umgebung (öffentlicher Raum) für 1h - 3h mit präzisem Zurückmelden. Weiters ist der Zugang zu einer Kantine, Mannerschnittautomaten und Kaffeautomaten gestatten. 
Der Entlassung aus der offenen Abteilung der Psychiatrie muss entweder
  • hoher Qualitätsstandard
    eine Untersuchung eines Arztes | einer Ärztin und eines Pflegers | einer Pflegerin und einer neutralen Verwaltungsperson der Klinik vorangehen (
oder
  • mittlerer Qualitätsstandard
    eine Untersuchung zumindest eines Arztes | einer Ärztin
vorangehen. Aus meiner Erfahrung trägt der Wille des Patienten zur Entlassung sehr wesentlich für eine schnellere Entlassung aus der Psychatrie bei.
Bei der Entlassung aus der Psychiatrie wird meist eine Depotspritze oder andere regelmäßig einzunehmende Psychopharmaka als Reszept verschrieben.

2. Psychotherapie (angewandte Psychologie)

Aus meiner Erfahrung bei zig Psycholog_innen Besuchen | Sitzungen ergab sich für mich folgendes Bild. Die Richtung in die therapiert | psychologisiert wird hängt doch sehr von entweder der inneren Prinzipien | psychologischen Ausbildungsschule | politischer oder weltanschaulicher Ansicht ab.
Ich nenne dafür einige Beispiele:
Sexualität wird von manchen sehr liberal angesehen, andere haben ein etwas familiärere Ausprägung und sehen zu frei ausgelebte Sexualität als zügellos an.
Manche Psychologen verordnen Wanderungen | Spaziergänge zur Gesundung, andere Entspannungsübungen, wieder andere kreatives Spielen, die wenigsten fordern allerdings mehr Disziplin im Beruf, als Unternehmer_in, beim freiwilligen sozialen Einsatz in einem gemeinnützigen Verein. (einzige Ausnahme hier Geriatrie),
Ich finde Psychologen und Psychotherapeuten sollten ihre Psychologieschule transparent bekanntgeben, so dass Patienten gemäß ihrer Priorität den am bessten passenden Psychotherapeut finden können.

3. Psychosoziale Dienste

Psychosoziale Dienste wie der PSD Wien stellen Services für Menschen mit leichten Hemnissen | Handicaps, leicht suchtkranke Menschen (Alkol und Tabletten inklusive), Menschen die unter Traumata leiden oder Sozialhilfe Bedürftige zur Verfügung. 
Patienten der psychosozialen Dienste Wien werden regelmäßig gemonitored und es kann eine Bestätigung für Justiz und Polizei vorgelegt werden.

Achtung: Alle Berichte erfolgen aus der privaten Sicht des Autors und sind nicht wissenschaftlich geprüft, statistisch kreuzverifiziert. Möglicherweise werden andere Patienten entsprechend ihrer Krankheit anders behandelt.

Nach Erfahrung mit all diesen praktizierenden Psychotherapeuten, Psychatrien und dem psychosoziale Dienst, der Stadt Wien, bevorzuge ich ausschließlich PSD Wien.
Die Kostenanteile für die SVS bei geschlossenen | offenen Psychatrien sind exobitant hoch und erscheinen qualvoll transparent auf meinsv.at. Psychotherapeuten sind finanziell wirklich günstig im Vergleich zu Zahnärzten, aber die unterschiedlichen Schulen stellten mich vor Probleme, da ich die Ausrichtung nicht wirklich im Vorhinein kannte. Der PSD ist komplett gratis und wird die Services vom PSD werden rein durch Steuergeld finanziert und weder einer SV noch dem Patienten gegen verrechnet.

Beispiel Kostenanteile Kepler 2021


2023-10-15

ATX and austrian stock market traded companies

#ATX (Austrian Traded Index) never ever reached high of 2008 again. https://www.google.com/finance/quote/ATX:INDEXVIE?window=MAX


#Raiffeisen International [ rbinternational.com ] seems to be a sitting duck, because of sanctions against Russia, but I'm sure that they could swap the Russian risk against something special. 

Some #ATX companies like #Andritz [ andritz.com ], #OMV [ omv.at ], #Verbund [ verbund.com ] seems to be very defiant against that trend.


CA IMMO [ caimmo.com ] was quiet profitable so far.


#Dynatrace [ dynatrace.com ] a newcomer was founded in Austria and is now traded in #NASDAQ
Find all Dynatrace locations in Austria at wko companies directory: 

#VoestAlpine [ voestalpine.com ] steel production and technology company will will likely lose share of world wide steel production, because raw iron supply chains are quiet long and expensive for VOEST location Linz:

Voest Alpine supply chains are A1 & OEBB

[ ALL INFOS WITHOUT WARRANTY AND ONLY OPINION OF AUTHOR ]

2023-07-29

Snow White Spinderula waked up after corona crisis, 7 dwarfs arround her and a lot of things disappeared

There was a girl named "Snow White Spinderula", who awaked from a stunned, cryostatic, petrified, paralyzed state, because she ate the forbidden fruit of knowledge from the apple tree in the garden of paradise and a piece of apple got stuck in her throat. 

Snow White Spinderula spits out the piece of apple, breathes and feels permeated again by the fresh and active spirit of life, recognizing that 7 dwarves standing around her.

Bit by bit she realizes now that many different things in the current world have disappeared or gone for ever and that this had nothing at all to do with the 7 dwarfs keeping an eye on her.

Disintegrated, disappeared, died ot transformed to void


Feminist internet blogs, groups and communities in social media

https://commons.wikimedia.org/wiki/File:Feminist.png


Microsoft Windows Phone

https://en.wikipedia.org/wiki/Windows_Phone


Small left parties, autonomous groups and comunity based projects

Autonomous left groups, community based left groups and projects and small left parties,
for example the Pirate Party, Europe anders, ...

https://en.wikipedia.org/wiki/Antifa_(Germany)

https://en.wikipedia.org/wiki/Pirate_Party


A lot of internet media  blogs in right, conservative and liberal spectrum were gone

Also a lot of conservative, right wing and liberal blogs moved to virtual graveyard also known as /dev/null or Nirvana.
It's sad to see many blogs from reasonable moderate-citizen first disappeared and in result of that disappearance many rescrictions by law were made against "more radical" groups:

It's so sad to realize, that so many groups from the left or middle-class spectrum of society disappeared, shut down their internet presence and blogs and let themselves be pushed out and no longer dared to express their opinion freely in public space or on main stream channels of the internet.

A lot of things concerning software, system and kernel programming

Some epic threats in newsnet (NNTP) newsgroups
Some very passionate discussions in the linux kernel newsgroup between Linus Torvalds and Alan Cox concerning sync before close, fbarrier as alternative to fsync with funny swipes to Alans work at Intel and drinking same kool-aid as other hardware cpu programmers.

Integration of NIS (Network Information Sytem originally called Yellow Pages) in latest apple OS.

Some projects on freshmeat.net sourceforge.net knowledge to use UDP for large - huge amount of data and the intention to develope a symmetric, asymmetric or certificate based standardized encryption for  all services based on UDP.

Realization that everything (file transfer, authentication, authorization including claims and bearer tokens, web services instead of old style Sun RPC or modern gRPC, VPN, ...) over HTTPS  might not be always the ideal solution and best practice and could be realized more service oriented otherwise.

Development of a more reliable driver and toolkit for mounting btrfs, ext2-4, xfs zfs file systems under Microsoft Windows 10-11.

or maybe not?

Full capacity of steel processing industry at voestalpine

Full capacity of stell processing industry at voestalpine Linz
https://www.voestalpine.com/highperformancemetals/international/en/


A Gothic Madonna replaced by a fake (both the original and the fake)

Photo of faked gothic madonna

Many other things will be reported soonly

Many other things will be reported soonly.

2023-06-30

VIC20 Emulatoren

und programmierte in BASIC ein einfaches Zahlenratespiel: 

10 LET U=RND(-625)
20 LET V=RND(0)
30 LET W=V*10
40 LET X=INT(W)
50 REM X ZAHL VON 1 BIS 10
100 INPUT “ERRATE ZAHL VON 0 BIS 10” ; A$
110 G0 LET B=VAL(A)
120 IF B < X THEN GOTO 160
130 IF B > X THEN GOTO 180
140 IF B = X THEN GOTO 200
160 PRINT “ IHRE ZAHL IST > GROESSER”
170 GOTO 100
180 PRINT “ IHRE ZAHL IST < KLEINER”
190 GOTO 100
200 PRINT “RICHTIG!”
210 END

2023-06-02

Commercial business livestyle, NPO and the few community based lifestyle, that we ignore

Common images in western societies from social and economic point of view:

Family (classic)

classic family based

At least one or both parents work most of the year and gain income for family. Family might get money from the state for the children to help getting them educated in public or private school and later an education to get a paid job in our economy.

Pair of adults (might be even gay or lesbian)

A pair in a kind of love or sexual relation lives together, because they cannot reproduce or don't want to have children. Normally both work (maybe not fulltime) and earn money.

Single adult (might be divorced father)

A single person lives alone, earns money.

Forgotten community based live styles

When you really open your eyes, you will find a lot of community based live styles, that were mostley not declared as community, but practically have the tendency / bias to live together as a community, were the priority to earn money is quiet low.
Some examples:
  1. extended family (were some of the members receive money in form of social benefits or unemployment insucrance from state, insucrances or relatives, could be clan based)
  2. spiritual or far left community (e.g. new age group, marxists, trotskyists, like-minded community)
  3. [Please enter you own expiriences here]
Unfortunately, the original form of old farmer families or kibbutz is really outdated.

Misunderstandings and conflicts concerning community based live forms

  • It is a mistake to assume that all community based lifestyles are voluntary, often it is economic pressure that leads to such living conditions.
  • But it is also wrong that nobody wants to live like this and people who live like this need education upgrades or training positions to enter jobs. 
  • Since community-based forms of life are mostly sustained by money that is not entirely self-earned, there is often the argument that they take it away from the really old and weak or disabled because it is mostly spent by the state.
  • Community based persons never understand the importance that somebody is stressed and races to an urgent meeting with an important wealth customer.
  • On the other hand, working people with functioning business models do not understand the obligations of community-based individuals, who often donate odd amounts of time to unnecessary inefficient rituals within the community.
  • Community based lifestyles are often viewed as precariously archaic or uncivilized, although the rules or code in such communities are often very complex, but often inhibit individuals from their full economic capacity or individual self-expression.
In my opinion we should sharpen our awareness and not a standard protocol or purely economic imperative when encountering these rare but nonetheless existing lifestyles.

Why I wrote this article:
Tonight my mind was clear and I saw, that some people don't want to be driven from an economic imperative and like more a community based life style. In Austria such people don't receive much money from the state, but often were discrimented or motivated to follow an economic working life model.


2023-05-09

2022-11-29

flex - fast lexical analyzer generator sample

Orginal posting can be fount here: http://blog.darkstar.work/2012/05/flex-fast-lexical-analyzer-generator.html

Who remember flex: fast lexical analyzer generator?

Here is a short sample, I have written it under gnu linux and ported it to win32 using gnuwin32 flex and getoptwin:

%option noyywrap

%{
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "getopt.h"
#include <string.h> 
#define MAXLEN 1024

int i, j, idx, len, mode = 0;
char tmps[MAXLEN], reverse[MAXLEN];

%}
SEGA  [2][5][0-5]
SEGB  [2][0-4][0-9]
SEGC  [1][0-9]{2}
SEGD  [1-9][0-9]{0,1}
SEG   {SEGA}|{SEGB}|{SEGC}|{SEGD}
IP    {SEG}["."]{SEG}["."]{SEG}["."]{SEG}

HOSTDOMAINSEGMENT [0-9a-zA-Z_"\-"]+["."]
TOPLEVELDOMAIN [a-zA-Z]{2,7}
HOSTNAME {HOSTDOMAINSEGMENT}+{TOPLEVELDOMAIN}
USER [0-9A-Za-z_"\-""."]+

EMAIL1 {USER}"@"{HOSTNAME}
EMAIL2 {USER}"@"{IP}

URIPROTOCOL [a-zA-Z]{2,10}"://"
URISUFFIX [^ \t\n\r"@"","">""<""("")""{""}"]
URL1   {URIPROTOCOL}{HOSTNAME}{URISUFFIX}*
URL2   {URIPROTOCOL}{IP}{URISUFFIX}*

%%
<<EOF>> {
        exit(1);
    }

{EMAIL1} |
{EMAIL2} {
        if (strchr(yytext, '@') != (char *)NULL) 
        {
    switch((mode % 16)) 
    {
case 0: strcpy(tmps, yytext); break;
case 1: strcpy(tmps, strchr(yytext, (int)'@')); break;
case 2: strcpy(tmps, &strchr(yytext, (int)'@')[1]); break;
     case 4: 
strcpy(tmps, &strchr(yytext, (int)'@')[1]);
len = strlen(tmps); 
for (j = 0, idx = 0; ((j < len) && (j < MAXLEN-1)); j++) 
{
                            if (tmps[j] == '.'
                            {
                                for (i = idx; i <= j; 
                                    reverse[(len-j) + (i-idx)] = tmps[i++]);
                                idx = j + 1;
                            }
}
for (i = idx; i <= j; 
                            reverse[(len-j) + (i-idx)] = (i < len) ? tmps[i] : '.', i++);
reverse[len + 1] = '\0';
strcpy(tmps, reverse);
break;
case 8: strcpy(tmps, &strrchr(yytext, (int)'.')[1]); break;
default: strcpy(tmps, yytext); break;
    }
    (void) printf("%s\n", tmps);
        }
    }

{URL1} |
{URL2} {
if (mode < 16) 
{
            switch((mode % 16)) 
            {
                case 0: strcpy(tmps, yytext); break;
         case 1: strcpy(tmps, strchr(yytext, (int)'/')); break;
         case 2: strcpy(tmps, &strrchr(yytext, (int)'/')[1]); break
         case 4: 
                        strcpy(tmps, &strrchr(yytext, (int)'/')[1]);
                        len = strlen(tmps);
                        for (j = 0, idx = 0; ((j < len) && (j < MAXLEN-1)) ; j++)
     {
                            if (tmps[j] == '.'
                            {
                                for (i = idx; i <= j; 
                                    reverse[(len-j) + (i-idx)] = tmps[i++]);
                                idx = j + 1;
                            }
                        }
                        for (i = idx; i <= j; 
                            reverse[(len-j) + (i-idx)] = (i < len) ? tmps[i] : '.', i++);
                        reverse[len + 1] = '\0';
                        strcpy(tmps, reverse);
                        break;
                case 8: strcpy(tmps, &strrchr(yytext, (int)'.')[1]); break;
                default: strcpy(tmps, yytext); break;
            }
            (void) printf("%s\n", tmps);
        }     
    } 

^[\n;] { ; }

[\r\n]+ { ; }

. { ; }

%%
void yyerror() { exit(1); }

void usage(const char *cmd) 
{
    (void) printf("Usage: %s [-f file] [-a ] [ -r ] [ -u ]\n", cmd);
    (void) printf("\t simple email address and uri lexer reads from stdin \n");
    (void) printf("\t -a, --noat    \t print only hostname of email address (all chars left of \'@\') \n");
    (void) printf("\t -u, --nouser  \t print email without username \n");
    (void) printf("\t -t, --top     \t prints domain toplevel only, when using option -a | -u \n");
    (void) printf("\t -n, --nouris \t print only email address and not uris\n");
    (void) printf("\t -r, --reverse \t reverse the hostdomain / ip address segments\n");
    
    exit(0);
}

int _tmain(int argc, TCHAR** argv)
{
    static int verbose_flag;
    int c;

    while(1)
    {
        static struct option long_options[] =
        {
            {_T("help"), ARG_NONE, 0, _T('h')},
            {_T("noat"), ARG_NONE, 0, _T('a')},
            {_T("nouser"), ARG_NONE, 0, _T('u')},
            {_T("top"), ARG_NONE, 0, _T('t')},
            {_T("nouris"), ARG_NONE, 0, _T('n')},
            {_T("reverse"),     ARG_NONE, 0, _T('r')},
            { ARG_NULL,         ARG_NULL, ARG_NULL, ARG_NULL}
        }; 

        int option_index = 0;
        c = getopt_long(argc, argv, _T("hautnr:"), long_options, &option_index);
        if (c == -1) 
            break;
        switch (c) // Handle options
        {
            case 0: // If this option set a flag, do nothing else now.
                    if (long_options[option_index].flag != 0)
                        break;
                    _tprintf (_T("option %s"), long_options[option_index].name);
                    if (optarg)
                        _tprintf (_T(" with arg %s"), optarg);
                    _tprintf (_T("\n"));
                    break;
            case _T('u'): mode = 1; break
            case _T('a'): mode = 2; break
            case _T('r'): mode = 4; break;
            case _T('h'): usage(argv[0]); break;
            case _T('t'): mode = 8; break;
            case _T('n'): mode += 16; break;  
            case '?': break// getopt_long already printed an error message. 
            default: abort();
        }
    }
    (void) fflush(stdout);
    yyin = stdin;
    yylex();
    exit(0);
}

Original posted 2011 here: http://www.area23.at/he/security/flex