Farhan's Personal and Professional Blog

Draw this shape without picking up your pen

For many years, while in a meeting or in a moment of free time, I have tried to draw this shape without picking up my pen or drawing over the same two points twice. At best I would get 1 line away, but never completed the shape. I wanted to know if it was even possible. So I wrote some python code to try every possible combination. But, the code is below.


FreeBSD and Linux Remote Dual Booting

The following is a quick and dirty guide on how to setup remote dual booting for FreeBSD (12.0-CURRENT) and Linux (Ubuntu 16.04). Granted, this method is slightly a hack, but it works and suits my needs. *Why remote dual-booting? I am currently developing a FreeBSD kernel module for a PCIe card. The device is supported on Linux and I am using the Linux implementation as documentation. As such, I find myself frequently rebooting into Linux to look printk() outputs, or booting into FreeBSD to test kernel code.


My Python3 Programming Environment

UPDATE: I have since started using a very good vimrc. I recommend it over mine listed below. My only modification is that I removed all line numbers, eww. I ssh into a FreeBSD jail with everything setup. The Jail runs on, which has an internet-routable IPv6 address – and IPv4 behind a NAT, (boo!) I have a virtualenv already built-out. (more about my pip list later) The set my ~/.


Hotspot Hijacking & Password Capturing

There are two types of penetration testers in the industry. Those who identify risk and vulnerabilities beyond a simple Nexpose/Nessus/Qualys scan. And those who want to “win”. The job of the “winner” is to get DA on their client’s network. Great! But once they’ve gotten it, they show off. Look how much information I can get with the DA account! I can get access to these databases and these spreadsheets. Sensitive Information!


Easytether running on ARMv7l Chromebook

Easytether is a proprietary application, so you can’t just apt-get it on a chroot’ed crouton environment. Additionally, I am not running an x86 or x64 CPU, so most of these packages will not work. Crouton mostly comes for Debian, so I downloaded the Ubuntu package. I installed the package ‘alien’. Then unzipped the deb file as follows: alien easytether_0.8.5-1_armhf.deb This will 3 tar.xz files, mostly importantly data.tar.xz. Unzip it with the following command:


Differences between Mint and Ubuntu

I looked into the differences between Mint and Ubuntu to see which was best for me. I watched tons of videos, reviews, comparisons, ran them both for months, etc. Here’s what I learned… They’re the same damn thing. No really, they are identical. The only differences are what software comes pre-installed and some user interface prettiness. Otherwise, no difference in the underlying system at all. Literally no difference. Next question?

Adding Arbitrary XML to python-docx

I am thankful to the developers of python-docx, they did a great job, especially since OpenXML is beyond confusing. However, I have two respectful criticisms: Python-docx lacks several key features and though it is properly written…its really confusing to follow the code. Its just a few steps. Identify the entry-point, create a new tag, and append it to the document. from docx.oxml.shared import OxmlElement # Necessary Import tags = document.element.xpath('//w:r') # Locate the right <w:r> tag tag = tags[0] # Specify which <w:r> tag you want child = OxmlElement('w:ARBITRARY') # Create arbitrary tag tag.


Convert Docx to Markdown

I needed to convert a Docx file to Markdown, but Pandoc kept giving me this obnoxious error: $ pandoc test.docx -o pandoc: Cannot decode byte '\xae': Data.Text.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream However, you can use the tool unoconv to make an intermediary step to convert first to HTML and then to Markdown. $ unoconv --stdout -f html test.docx | pandoc -f html -t markdown -o On Ubuntu (And other Debian-based systems I would imagine) you can get unoconv with a simple apt-get install unoconv.


Duplicate a Django modelformset_factory Form

I created a formset_factory and wanted to have a simple “click me to add another form”. This seemed like a routine task, but the solutions I found online were unnecessarily complicated or required me to install a separate Django app, which I had no intention of doing. So I created my own… The only pre-requirement that this needs besides standard Django is jQuery. So here is a rough overview of how this works:


Custom Django Fixture Imports

I needed to convert an XML document into a customize Django model with modifications to the based on programmable logic. Converting it to my model’s fixture would take too long and be unnecessary work, so I instead opted to manually convert the data. I figured I could just import the Django model object, as is follows: from tester.models import Control a = Control() However, I got the following vexing error in red:

Previous Page 3 of 4 Next Page