Use mysql’s `replace into` safely!

Introduction MySQL’s popular replace into destination_database.destination_table (fields) select fields from source_database.source_table; query can be very dangerous if not used properly. Illustration Say, you have schema’s like: create table source_table ( field1 bigint not null, field2 int not null, field3 varchar(50) default '0' not null, primary key (field1, field2) ); create table destination_table ( field1 bigint not null, field2 int not null, field3 varchar(50) default '0' not null, primary key (field1, field2) ); Now, if you want to replace some data from source table to the destination table, you can do something like:...

September 20, 2018 · 2 min · Sourav Badami

The Hacker Manifesto

Credits: +++The Mentor+++, Written January 8, 1986. Another one got caught today, it’s all over the papers. “Teenager Arrested in Computer Crime Scandal”, Hacker, Arrested after Bank Tampering”… Damn kids. They’re all alike. But did you, in your three-piece psychology and 1950’s technobrain, ever take a look behind the eyes of the hacker,? Did you ever wonder what made him tick, what forces shaped him, what may have molded him?...

April 22, 2018 · 3 min · Sourav Badami

The requested address is not valid in its context

Introduction Facing this issue with Python2.7 and Ftplib ? I won’t waste your time talking shit! Let’s fix it. Create a new class inheriting Ftplib’s FTP_TLS class. import ftplib class FTP_TLS_UNROUTABLE_HOST(ftplib.FTP_TLS, object): def makepasv(self): _, port = super(FTP_TLS_UNROUTABLE_HOST, self).makepasv() return self.host, port Now, use this new class to create a new session. session = FTP_TLS_UNROUTABLE_HOST('host','username','password') Now ? Do whatever you want with your session :) It won’t cry for The requested address is not valid in its context....

November 15, 2017 · 1 min · Sourav Badami

Logstash -> Azure Event Hub | Log & Event Management Utility | NodeJS

Logstash is an open source data collection engine with real-time pipelining capabilities. Logstash can dynamically unify data from disparate sources and normalize the data into destinations of your choice. Cleanse and democratize all your data for diverse advanced downstream analytics and visualization use cases. (Source) Event Hubs is a highly scalable data streaming platform capable of ingesting millions of events per second. Data sent to an Event Hub can be transformed and stored using any real-time analytics provider or batching/storage adapters....

March 17, 2017 · 2 min · Sourav Badami

MyCleanIndia App

An application which let’s you tag unhygienic spaces. It is build on top of Google Maps using GMAPS API V3. Backend is written on Python. Here’s the code. The application got featured on YourStory and EFY Group’s, OpenSourceForYou.

January 9, 2017 · 1 min · Sourav Badami

Passport Status Change Notifier

A simple script which notifies you whenever the current status of your Indian passport application changes. It keeps checking for the status change automatically every hour and if the change occurs, the user receives a desktop notification. Here’s the code.

October 16, 2016 · 1 min · Sourav Badami

Duckduckgo — ComeToTheDuckSide

The open source search engine that doesn’t track or store your personal information. The other giants show you creepy ads and sell your information to advertisers. Stop being followed, start using DuckDuckGo. You can hack into the search engine to create IA’s and cheatsheets to help everyone around to get information instantly without clicking on blue links. We call it, ZeroClickInfo. You can create fatheads, goodies and several other IA’s to help people find what they are looking for....

September 16, 2016 · 1 min · Sourav Badami

Advanced Packaging Tool

Do you know what is apt-get — that you use frequently on your debian console ? APT is the front end version of the debian package manager, dpkg. It provides the apt-get utility and APT dselect method that provides a simpler, safer way to install and upgrade packages. Here’s the SCM Repository –> https://alioth.debian.org/anonscm/git/apt/apt.git. The most recent release appears to be Release 1.3~rc4 ( according to the logs ). rpm‘s can also be compiled on the debian platform, although compatibility often causes a problem....

September 12, 2016 · 1 min · Sourav Badami

Calendar Application

A Django based application which helps user to save their events on a calendar and sync their calendar with private google calendar. Here’s the link to the repository with build instructions. It’s instance is deployed at Heroku.

August 29, 2016 · 1 min · Sourav Badami

Birthday Wishing Bot

A simple bot written using graph API which parses a list of birthdays and adds a birthday wish post on a facebook page. Find the code here.

August 23, 2016 · 1 min · Sourav Badami