Log4net tutorial – Great library for logging

log4net tutorial– Great library for logging

A lot of applications use logging as a way to store information about performed operations. Such data is very useful when you have to diagnose an issue. Logging could be done on many ways, but sometimes it’s just easier to use an existing solution. I’d like to introduce one of many libraries for logging, but quite powerful – log4net.

Get log4net

Let’s create a console application – log4netTutorial. Next you have to reference log4net library. The easiest way is to install NuGet package:

    • Right click your project
    • Click Manage NuGet Packages…
    • Click Online on the left hand panel
    • Type log4net in search box on the right side
    • Select log4net package and click Install

Continue reading “Log4net tutorial – Great library for logging”

How does the RemoteSigned execution policy work?


You might have wondered how the “RemoteSigned” execution policy protects us from running unsigned PowerShell scripts downloaded from the internet. We use the URL Security Zones API related to “Attachment Execution Service” (AES) introduced in Windows XP SP2 and Windows Server 2003 SP1. Internet Explorer and Outlook Express are among the applications that participate in the AES system, while FireFox, Microsoft Office Outlook and Live Messenger do not follow AES.

Continue reading “How does the RemoteSigned execution policy work?”

The object-orientedness of PowerShell and what you see may not be what you get

PS ewu\My Documents\GitHub\PowerShell> get-aduser ewu -Properties LastLogonDate | Select LastLogonDate

1/1/2016 6:22:01 PM

PS ewu\My Documents\GitHub\PowerShell> get-aduser ewu -Properties LastLogonDate | Select LastLogonDate | gm

TypeName: Selected.Microsoft.ActiveDirectory.Management.ADUser


PS ewu\My Documents\GitHub\PowerShell> (get-aduser ewu -Properties LastLogonDate | Select LastLogonDate).LastLogonDate

Friday, January 01, 2016 6:22:01 PM

PS ewu\My Documents\GitHub\PowerShell> (get-aduser ewu -Properties LastLogonDate | Select LastLogonDate).LastLogonDate | gm

TypeName: System.DateTime


PS ewu> (get-aduser ewu -Properties LastLogonDate | Select LastLogonDate).LastLogonDate

Friday, January 01, 2016 6:22:01 PM

PS ewu> ((get-aduser ewu -Properties LastLogonDate | Select LastLogonDate).LastLogonDate | Out-String) -like “*Jan*2016*”

PS ewu> (get-aduser ewu -Properties LastLogonDate | Select LastLogonDate | out-string)

1/1/2016 6:22:01 PM

PS ewu> (get-aduser ewu -Properties LastLogonDate | Select LastLogonDate | out-string) -like “*1*2016”

&& and || operators

The right side of && will only be evaluated if the exit status of the left side is zero. || is the opposite: it will evaluate the right side only if the left side exit status is nonzero. You can consider [ … ] to be a program with a return value. If the test inside evaluates to true, it returns zero; it returns nonzero otherwise.

$ false && echo howdy!

$ true && echo howdy!
$ true || echo howdy!

$ false || echo howdy!

The Official Bankster Dictionary

The Official Bankster Dictionary

In the underground world of banking, doing wrong means doing right, up is down, and left is right. I happened to stumble upon a secret version of the Bankster’s Dictionary the other day when I was visiting a bank. I’ve posted some of the terms below that were contained in the Bankster’s Dictionary to help you understand bankster language.

US Federal Reserve = European controlled private bank.
Central Bank = Counterfeiting Ring Leader
Criminal Underworld Currency Counterfeiters = Competitors that must be arrested and jailed.
Savings Account = Devaluation Account, Cash Advance for Gambling Division

Gambling = Banking Primary Business Line
Fraud = Banking Secondary Business Line
Las Vegas, Macau, Atlantic City = Model for running business operations.
Inflation = Currency Devaluation through anti-free market manipulation of interest rates.
Fractional Reserve System = Fractional Expansion Citizen Bankruptcy System, BSE (Biggest Scam Ever)
Futures Markets = Manipulation Casino, SkyNet Three-Card Monte Scam
Pablo Escobar, Joaquín ‘El Chapo’ Guzmán, The Ochoa Hermanos, Yakuza = Cash Cows
El Subcomandante Marcos aka Delegado Zero = Anti-poverty activist that must be wacked and shut up
Independent Media = Terrorist
Mass Media = Allies
Allen Stanford, Bernie Madoff = Occasional Patsies and Necessary Fall Guys to appease the public’s ire at us.
Stock Markets = Manipulation Casino, SkyNet Three-Card Monte Scam
Commercial Investment Firm Rating of “Buy” and Hold” = Contrarian Indicator to SELL!
Commercial Investment Firm Rating of “Sell” = Contrarian Indicator to “BUY!”
Barbarous Relic = USD, Euro, Yen
Beta = Empty Statistic meant to impress naïve investors
Loan = Usury
USD, Euro, Yen, etc. = Fantasy Digital Idea made real by banksters to control humanity
Women’s Liberation Movement = Expansion of Tax Base from only men to men AND women
Income Taxes = Wealth Transfer from citizens to owners of central banks.
Gold = Bankster Kryptonite
Silver = Bankster Kryptonite
Truth = Banker Kyrptonite
Lies & Deception = Bankster Standard M.O.
Free Markets = Fairytale story like Santa Claus, Easter Bunny and Tooth Fairy to be taught in business schools worldwide.
Drug Lords and Underground Crime Syndicates = Provider of global banking liquidity and huge year-end bonuses
Parasite = Favorite insect
Capitalism = Dead system that was killed by Central Banking but false scapegoat we can blame when we cause economic crashes and despair
Miscellaneous Charges = Small Monthly Charges to siphon off money from bank accounts that customers will never notice or complain about
Computer = Vehicle to rig all stock markets and commodity markets with HFT programs that execute trades not possible if executed by humans and if executed in a clear and transparent market.
Boom = Unsustainable price distortions caused by interest-rate manipulation and market rigging.
Bust = Opportunity to make money twice as quickly as in a boom!
Market Crash = Engineered event to ensure the peasants will never accumulate enough wealth to rebel against us.
Rising Markets on Mondays or Tuesdays into OpEx Fridays: Ruse to sucker more people to go long in order to fleece them by the time Friday arrives.
Declining Markets on Mondays or Tuesdays into OpEx Fridays: Ruse to sucker more people to go short in order to fleece them by the time Friday arrives.
Presidents and PMs = Best puppet and marionette allies to be rewarded handsomely after they leave office (see Tony Blair and the current POTUS)
Superior Judges, SCOTUS = Made Men
War = Double Bonus! Opportunity to devalue money at faster rate than during peace time and opportunity to accumulate more wealth from interest charged on war appropriations.
Universities, Colleges and MBA programs = Re-education camps to indoctrinate students into fairytales of non-existent free markets, non-existent capitalism, and lies about how stock markets, real estate markets and economic cycles really work.
Economic Journals and University Tenure = Carrot dangled in front of economic professors to ensure that they repeat to the world the “official” party line.
Key Economic Indicators = False manipulated statistics designed to dumb down citizens into believing economy is recovering even as we increase their economic suffering
Ben Bernarnke = Shakespearean clown.
Conspiracy = Best Word to Discredit Truth about the global monetary system when the truth somehow escapes our censorship algorithms and makes it to the mainstream media we control.
Machiavelli = Role Model
Ivy League Schools = Indoctrination Camps for media representatives and professors we will send to brainwash other global regions into believing our propaganda
CNBC = The Cartoon Network.
Goldman Sachs = Rookie Farm Camp for global criminal banking syndicate.
World Bank & IMF = Banks used by Western countries to impose crushing debt on developing nations to stunt their growth.
Bailout = Transfer of Wealth from citizens to us.
TBTF = Lie used to ensure we can perpetuate fraud.
Quantitative Easing = Currency Devaluation.
Fiat Currency = Worst Possible Idea
Propaganda = Daily Financial News Feed
Compartamentalization = Process to keep good people working as cogs in the machine within the banking industry ignorant of the fact that they are inflicting massive harm upon society.

If others of you have had the good fortune to stumble across this secret Bankster Dictionary like me, please feel free to post more Bankster glossary terms below.

SSH Tunnel – Local and Remote Port Forwarding Explained With Examples


There are two ways to create an SSH tunnel, local and remote port forwarding (there’s also dynamic forwarding, but we won’t cover that here). The best way to understand these is by an example, let’s start with local port forwarding.

Imagine you’re on a private network which doesn’t allow connections to a specific server. Let’s say you’re at work and imgur.com is being blocked. To get around this we can create a tunnel through a server which isn’t on our network and thus can access Imgur.

$ ssh -L 9000:imgur.com:80 [email protected]

The key here is -L which says we’re doing local port forwarding. Then it says we’re forwarding our local port 9000 to imgur.com:80, which is the default port for HTTP. Now open your browser and go to http://localhost:9000.The awesome thing about SSH tunnels is that they are encrypted. Nobody is going to see what sites you’re visiting, they’ll only see an SSH connection to your server.

Connecting to a database behind a firewall

Another good example is if you need to access a port on your server which can only be accessed from localhost and not remotely.An example here is when you need to connect to a database console, which only allows local connection for security reasons. Let’s say you’re running PostgreSQL on your server, which by default listens on the port 5432.

$ ssh -L 9000:localhost:5432 [email protected]

The part that changed here is the localhost:5432, which says to forward connections from your local port 9000 to localhost:5432 on your server. Now we can simply connect to our database.

$ psql -h localhost -p 9000

Now let’s stop here for a little bit an explain what is actually going on. In the first example the 9000:imgur.com:80 is actually saying forward my local port 9000 to imgur.com at port 80. You can imagine SSH on your server actually making a connection (a tunnel) between those two ports, one on your local machine, and one on the target destination.If we however say something like 9000:localhost:5432, it means localhost from the server’s perspective, not localhost on your machine. This means forward my local port 9000 to port 5432 on the server, because when you’re on the server, localhost means the server itself.

This might be a bit confusing, but it is important to understand what the syntax actually means here.

Remote port forwarding

Now comes the second part of this tutorial, which is remote port forwarding. This is again best to explain with an example.Say that you’re developing a Rails application on your local machine, and you’d like to show it to a friend. Unfortunately your ISP didn’t provide you with a public IP address, so it’s not possible to connect to your machine directly via the internet.

Sometimes this can be solved by configuring NAT (Network Address Translation) on your router, but this doesn’t always work, and it requires you to change the configuration on your router, which isn’t always desirable. This solution also doesn’t work when you don’t have admin access on your network.

To fix this problem you need to have another computer, which is publicly accessible and have SSH access to it. It can be any server on the internet, as long as you can connect to it. We’ll tell SSH to make a tunnel that opens up a new port on the server, and connects it to a local port on your machine.

$ ssh -R 9000:localhost:3000 [email protected]

The syntax here is very similar to local port forwarding, with a single change of -L for -R. But as with local port forwarding, the syntax remains the same.First you need to specify the port on which the remote server will listen, which in this case is 9000, and next follows localhost for your local machine, and the local port, which in this case is 3000.

There is one more thing you need to do to enable this. SSH doesn’t by default allow remote hosts to forwarded ports. To enable this open /etc/ssh/sshd_config and add the following line somewhere in that config file.

GatewayPorts yes

Make sure you add it only once!

$ sudo vim /etc/ssh/sshd_config

And restart SSH

$ sudo service ssh restart

After this you should be able to connect to the server remotely, even from your local machine. The way this would work is that you would first create an SSH tunnel that forwards traffic from the server on port 9000 to your local machine on port 3000. This means that if you connect to the server on port 9000 from your local machine, you’ll actually make a request to your machine through the SSH tunnel.

A few closing tips

You might have noticed that every time we create a tunnel you also SSH into the server and get a shell. This isn’t usually necessary, as you’re just trying to create a tunnel. To avoid this we can run SSH with the -nNT flags, such as the following, which will cause SSH to not allocate a tty and only do the port forwarding.

$ ssh -nNT -L 9000:imgur.com:80 [email protected]

SSH has a huge number of features, so I’d recommend you to checkout the manual page at man ssh, which contains even more tips.There’s also an amazing talk called The Black Magic of SSH / SSH Can Do That?, which I really recommend you to watch.

Linux Articles






沈复在沧浪亭畔生活多年。沧浪亭位于苏州古城南北主干道人民路稍南端的东侧,初为北宋诗人苏舜钦所建,现已列入世界文化遗产名录。沧浪亭北侧临水, 楼台亭阁,一座典型的江南小园林。”过石桥,进门,折东曲径而入,叠石成山,林木葱翠。亭在土山之巅。” 现状与书中描述完全吻合,但土山不高,至多只有两层楼那么高。当时的”周望极目可数里”当然已不可能。园中的”看山楼”似乎更高些。据书中”…居沧浪亭爱 莲居西间壁,板桥内一轩临流,…檐前老树一株,浓荫覆窗,…隔岸游人往来不绝…”的文字,可推测沈复的住宅应位于沧浪亭园林的西侧,即现在的人民路到沧浪 亭园林之间(现为几家商店)。因现在园内建筑中已没有名为”爱莲居”的房间,最西处是”锄月轩”和”藕花水榭”,沈复和陈芸婚后消夏之处很可能就是”锄月 轩”或旁边临河处。沧浪亭的河对面有一个小园林名”可园”,从网上资料(沧浪区志)证实其前身即为书中所述的”近山林”和”正谊书院”。

Continue reading “浮生六记中沧浪寻迹”

Why Is Independence So Frightening To Some People?

In past articles I have examined the nature of power and division in our society and have always come to the same conclusion, that there are only two types of people: the people who want control over others and the people who just want to be left alone. However, there are also subgroups that swim within the boundaries of each end of the spectrum. Often, psychologists and self-help gurus attempt to promote the idea that the defining quality of the average person’s life is whether he is a follower or a leader. I have seen this spectrum applied to every political and social organization.
Continue reading “Why Is Independence So Frightening To Some People?”