Karambir Singh Nainhttps://karambir.in/2023-08-19T00:00:00+05:30My Python Programming Workflow2023-08-19T00:00:00+05:302023-08-19T00:00:00+05:30Karambir Singh Naintag:karambir.in,2023-08-19:/posts/pyton-programming-workflow/<blockquote>
<p><strong>Note</strong>: This is a live document with pointers, not a blog post</p>
</blockquote>
<p>How do I do python programming.</p>
<h2>Basic Setup</h2>
<p>Setup <a href="https://asdf-vm.com/">asdf</a> to manage multiple python, node and golang versions</p>
<p>Install python versions using asdf:</p>
<div class="highlight"><pre><span></span><code>asdf<span class="w"> </span>install<span class="w"> </span>python<span class="w"> </span><span class="m">3</span>.9.17
asdf<span class="w"> </span>install<span class="w"> </span>python<span class="w"> </span><span class="m">3</span>.10.12
asdf<span class="w"> </span>install<span class="w"> </span>python …</code></pre></div><blockquote>
<p><strong>Note</strong>: This is a live document with pointers, not a blog post</p>
</blockquote>
<p>How do I do python programming.</p>
<h2>Basic Setup</h2>
<p>Setup <a href="https://asdf-vm.com/">asdf</a> to manage multiple python, node and golang versions</p>
<p>Install python versions using asdf:</p>
<div class="highlight"><pre><span></span><code>asdf<span class="w"> </span>install<span class="w"> </span>python<span class="w"> </span><span class="m">3</span>.9.17
asdf<span class="w"> </span>install<span class="w"> </span>python<span class="w"> </span><span class="m">3</span>.10.12
asdf<span class="w"> </span>install<span class="w"> </span>python<span class="w"> </span><span class="m">3</span>.11.4
</code></pre></div>
<p>Install <a href="https://pypa.github.io/pipx/">pipx</a> using system package manager like pacman, apt, brew. It creates separate virtualenvs for each python cli tool you install.
Tell pipx to use one of the python version installed by asdf by adding following to <code>.bashrc</code> or <code>.zshrc</code>:</p>
<div class="highlight"><pre><span></span><code><span class="nv">PIPX_DEFAULT_PYTHON</span><span class="o">=</span>/home/user/.asdf/installs/python/3.10.12/bin/python
</code></pre></div>
<p>Use pipx to manage python cli software </p>
<ul>
<li>cookiecutter</li>
<li>pgcli</li>
<li>poetry</li>
<li>pre-commit</li>
</ul>
<h2>Project Setup</h2>
<p>Activate correct python version using asdf <code>asdf local python 3.11.4</code>.
This creates a <code>.tool-versions</code> file in local directory so in-future it automatically picks correct version. This file can be committed to git as well.</p>
<p>Create and use virtualenv using built-in venv package via bash aliases</p>
<div class="highlight"><pre><span></span><code><span class="nb">alias</span><span class="w"> </span><span class="nv">cv</span><span class="o">=</span><span class="s1">'python -m venv .venv'</span>
<span class="nb">alias</span><span class="w"> </span><span class="nv">cv</span><span class="o">=</span><span class="s1">'python -m venv .venv'</span>
</code></pre></div>
<p><a href="https://python-poetry.org/">Poetry</a> can also be used to create and activate virtualenv automatically using <code>poetry run</code> commands. Configure poetry with:</p>
<div class="highlight"><pre><span></span><code>poetry<span class="w"> </span>config<span class="w"> </span>virtualenvs.create<span class="w"> </span><span class="nb">true</span>
poetry<span class="w"> </span>config<span class="w"> </span>virtualenvs.in-project<span class="w"> </span><span class="nb">true</span>
</code></pre></div>
<p>Why not using <em>mkvirtualenvwrapper</em>?</p>
<p>Use Poetry to install and manage dependencies.</p>
<p>For linting:</p>
<ul>
<li>black</li>
<li>isort</li>
<li>mypy</li>
<li>~~flake8~~ <a href="https://github.com/astral-sh/ruff">Ruff</a>(install separately)</li>
</ul>
<p>For documentation and versioning:</p>
<ul>
<li>mkdocs</li>
<li>bump2version</li>
</ul>
<p>For testing:</p>
<ul>
<li>pytest with mock, cov extensions</li>
<li>faker</li>
<li>ipdb</li>
<li>tox if multiple python env and package versions are required</li>
</ul>
<p>Keep most configs for these packages in <code>pyproject.toml</code>. If not, use setup.cfg. Avoid tool specific config file.</p>
<p>Use Makefile with frequently used commands.</p>
<h2>Editor Setup</h2>
<p>Use Vim or Vim Mode in Pycharm</p>
<p>Have plugins like EditorConfig</p>
<div class="highlight"><pre><span></span><code><span class="n">root</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">true</span>
<span class="o">[</span><span class="n">*</span><span class="o">]</span>
<span class="n">charset</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">utf</span><span class="o">-</span><span class="mi">8</span>
<span class="n">end_of_line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lf</span>
<span class="n">insert_final_newline</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">true</span>
<span class="n">trim_trailing_whitespace</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">true</span>
<span class="o">[</span><span class="n">*.{py,rst,ini}</span><span class="o">]</span>
<span class="n">indent_style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">space</span>
<span class="n">indent_size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span>
<span class="o">[</span><span class="n">*.{html,css,scss,json,yml}</span><span class="o">]</span>
<span class="n">line_length</span><span class="o">=</span><span class="mi">120</span>
<span class="n">indent_style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">space</span>
<span class="n">indent_size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span>
<span class="o">[</span><span class="n">*.md</span><span class="o">]</span>
<span class="n">trim_trailing_whitespace</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">false</span>
<span class="o">[</span><span class="n">Makefile</span><span class="o">]</span>
<span class="n">indent_style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tab</span>
</code></pre></div>
<p>For pycharm, setup configurations to run tests and tool being developed.</p>
<h2>Major packages I find awesome</h2>
<ul>
<li>Django</li>
<li>Django Rest Framework</li>
<li>FastAPI and Starlette</li>
<li>SQLAlchemy</li>
<li>Encode databases and httpx</li>
<li>Celery</li>
<li>dotenv</li>
<li>click</li>
<li>loguru(structlog is equally awesome)</li>
<li>django-mptt</li>
<li>open telemetry</li>
<li>psycopg2</li>
<li>uwsgi or gunicorn</li>
</ul>
<h2>While Programming</h2>
<p>Use extensive logging with packages like loguru. Enable debug logging locally for external calls like File IO, db or network requests.
Try using structured logging(json?) to attach extra context to logs</p>
<h2>CI</h2>
<p>Use GitHub actions or Gitlab CI for testing, building and releasing.</p>Simple Linux Tips and Tricks2021-10-01T00:00:00+05:302023-08-19T00:00:00+05:30Karambir Singh Naintag:karambir.in,2021-10-01:/posts/linux-tips-tricks/<p>Using Ubuntu(<a href="https://pop.system76.com/">Pop!_OS</a>) and <a href="https://archlinux.org/">Arch</a> for a decade and I still forget how to do simple tasks. I am documenting a few here and will keep updating this for future reference.</p>
<h2>Quick Upgrade Ubuntu or Arch</h2>
<p>Add one of the following to <code>~/.bashrc</code>:</p>
<div class="highlight"><pre><span></span><code><span class="nb">alias</span><span class="w"> </span><span class="nv">_ug</span><span class="o">=</span><span class="s2">"yay -Syu --devel --needed …</span></code></pre></div><p>Using Ubuntu(<a href="https://pop.system76.com/">Pop!_OS</a>) and <a href="https://archlinux.org/">Arch</a> for a decade and I still forget how to do simple tasks. I am documenting a few here and will keep updating this for future reference.</p>
<h2>Quick Upgrade Ubuntu or Arch</h2>
<p>Add one of the following to <code>~/.bashrc</code>:</p>
<div class="highlight"><pre><span></span><code><span class="nb">alias</span><span class="w"> </span><span class="nv">_ug</span><span class="o">=</span><span class="s2">"yay -Syu --devel --needed && flatpak update --noninteractive"</span>
<span class="nb">alias</span><span class="w"> </span><span class="nv">_ug</span><span class="o">=</span><span class="s2">"sudo apt update && sudo apt upgrade -y && flatpak update --noninteractive"</span>
</code></pre></div>
<p>Arch based system is using <a href="https://github.com/Jguer/yay">yay</a>, pacman wrapper and aur helper.</p>
<h2>Download Videos</h2>
<p>Use <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> to download videos for offline viewing:</p>
<div class="highlight"><pre><span></span><code>yt-dlp<span class="w"> </span>-f<span class="w"> </span><span class="s2">"bestvideo[height<=2160][vcodec!^=av01]+bestaudio/best[height<=2160][vcodec!^=av01]"</span><span class="w"> </span>--all-subs<span class="w"> </span>--convert-subs<span class="w"> </span>srt<span class="w"> </span>--embed-subs<span class="w"> </span>--external-downloader<span class="w"> </span>aria2c
</code></pre></div>
<h2>Check drive temperatures</h2>
<p>Use <a href="https://wiki.archlinux.org/title/Hddtemp">HddTemp</a> package</p>
<div class="highlight"><pre><span></span><code>sudo hddtemp /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh
</code></pre></div>
<h2>tar archives</h2>
<p>Tar has the following options:</p>
<ul>
<li><code>-c</code> is crate archive mode, others are options in that mode</li>
<li><code>-x</code> is extract archive mode</li>
<li><code>-v</code> verbose</li>
<li><code>-z</code> create gzip</li>
<li><code>-f</code> tar filename</li>
</ul>
<p>Create <code>tar -cvzf test.tar.gz test-dir/</code></p>
<p>Extract <code>tar -xvzf test.tar.gz /op/test</code></p>
<h2>Split and combine large files</h2>
<p>Split command can be used to split large files into many smaller ones:</p>
<p>e.g. <code>split -b 50M thunderbird-profile.tar.gz "profile.tar.gz.part."</code></p>
<p>Similarly to combine these files again, use cat:</p>
<p>e.g. <code>cat profile.tar.gz.part.* > thunderbird.profile.tar.gz</code></p>
<h2>Combine multiple pdf files</h2>
<p>The command <code>pdfunite</code> does this job well. It is part of <code>popplet-utils</code> package</p>
<div class="highlight"><pre><span></span><code>sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>poppler-utils
pdfunite<span class="w"> </span>file1.pdf<span class="w"> </span>file2.pdf<span class="w"> </span>file3.pdf<span class="w"> </span>output.pdf
</code></pre></div>
<h2>Remove password from protected pdf file</h2>
<ol>
<li>Install <code>pdftk</code></li>
<li><code>sudo apt install pdftk</code></li>
<li><code>pdftk <path-to-encrypted.pdf> input_pw <password> output <new-file.pdf></code></li>
</ol>
<p>Newer protection mechanisms are not <a href="https://gitlab.com/pdftk-java/pdftk/-/issues/87">supported by pdftk</a>. Use <code>qpdf</code> for those:</p>
<div class="highlight"><pre><span></span><code>qpdf<span class="w"> </span><path-to-encrypted.pdf><span class="w"> </span>--password<span class="o">=</span><password><span class="w"> </span>--decrypt<span class="w"> </span><new-file.pdf>
</code></pre></div>
<h2>Remove password for all protected pdf files in DIR</h2>
<p>(Optional) First rename all files with some suffix </p>
<div class="highlight"><pre><span></span><code>rename<span class="w"> </span>.pdf<span class="w"> </span>_protected.pdf<span class="w"> </span>*
</code></pre></div>
<p>Decrypt all files ending with <code>_protected.pdf</code> and output files with suffix</p>
<div class="highlight"><pre><span></span><code><span class="k">for</span><span class="w"> </span>filename<span class="w"> </span><span class="k">in</span><span class="w"> </span>*_protected.pdf<span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span><span class="nv">IFS</span><span class="o">=</span><span class="s1">'_'</span><span class="w"> </span><span class="nb">read</span><span class="w"> </span>-ra<span class="w"> </span>file_first<span class="w"> </span>file_ext<span class="w"> </span><span class="o"><<<</span><span class="w"> </span><span class="s2">"</span><span class="nv">$filename</span><span class="s2">"</span><span class="p">;</span><span class="w"> </span>pdftk<span class="w"> </span><span class="nv">$filename</span><span class="w"> </span>input_pw<span class="w"> </span><password><span class="w"> </span>output<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="nv">file_first</span><span class="si">}</span><span class="s2">.pdf"</span><span class="p">;</span><span class="w"> </span><span class="k">done</span>
</code></pre></div>
<h2>Socks proxy</h2>
<div class="highlight"><pre><span></span><code><span class="n">ssh</span><span class="w"> </span><span class="o">-</span><span class="n">D</span><span class="w"> </span><span class="mi">8123</span><span class="w"> </span><span class="o">-</span><span class="n">f</span><span class="w"> </span><span class="o">-</span><span class="n">C</span><span class="w"> </span><span class="o">-</span><span class="n">q</span><span class="w"> </span><span class="o">-</span><span class="n">N</span><span class="w"> </span><span class="o"><</span><span class="k">user</span><span class="nv">@example</span><span class="p">.</span><span class="n">com</span><span class="o">></span>
</code></pre></div>
<h2>Monitor ongoing tcp traffic</h2>
<div class="highlight"><pre><span></span><code>sudo tcpdump -i eth0
</code></pre></div>
<h2>List open TCP ports</h2>
<div class="highlight"><pre><span></span><code>sudo ss -plnt
</code></pre></div>
<h2>Disable Gnome tracker daemon</h2>
<p>It hogs cores when files are changing fast.</p>
<p>https://gist.github.com/vancluever/d34b41eb77e6d077887c</p>
<h2>Flash windows ISO to usb</h2>
<p>Installation</p>
<div class="highlight"><pre><span></span><code>sudo<span class="w"> </span>add-apt-repository<span class="w"> </span>ppa:tomtomtom/woeusb
sudo<span class="w"> </span>apt<span class="w"> </span>update
sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>woeusb<span class="w"> </span>wimtools
<span class="c1"># Then flash ISO</span>
sudo<span class="w"> </span>woeusb<span class="w"> </span>--device<span class="w"> </span>windows.iso<span class="w"> </span>/dev/sda
</code></pre></div>
<h2>Check Postgres table size</h2>
<div class="highlight"><pre><span></span><code>SELECT table_name, pg_relation_size(quote_ident(table_name)), pg_size_pretty(pg_relation_size(quote_ident(table_name))) FROM information_schema.tables WHERE table_schema = 'pub
lic' ORDER BY 2 DESC;
</code></pre></div>
<h2>Backup and restore containerized Postgres db</h2>
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>-t<span class="w"> </span><span class="s2">"container_id"</span><span class="w"> </span>pg_dump<span class="w"> </span>--no-owner<span class="w"> </span>--quote-all-identifiers<span class="w"> </span>-U<span class="w"> </span><span class="s2">"pg_user"</span><span class="w"> </span><span class="s2">"pg_db"</span><span class="w"> </span>><span class="w"> </span>dump_<span class="sb">`</span>date<span class="w"> </span>+%d-%m-%Y<span class="s2">"_"</span>%H_%M_%S<span class="sb">`</span>.sql
</code></pre></div>
<p>Either restore using psql execute or give postgres docker container sql file in initrd</p>
<div class="highlight"><pre><span></span><code>cat<span class="w"> </span>dump_01-01-2020_20_00_00.sql<span class="w"> </span><span class="p">|</span><span class="w"> </span>docker<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>-i<span class="w"> </span><span class="s2">"container_id"</span><span class="w"> </span>psql<span class="w"> </span>-U<span class="w"> </span><span class="s2">"pg_user"</span><span class="w"> </span><span class="s2">"pg_db"</span>
</code></pre></div>
<h2>Linux Swiss Army Knife</h2>
<p><a href="https://github.com/gchq/CyberChef">Cyberchef</a> is the best software tool to do daily task that a programmer or sysadmin might need to do.
It gives a lot of recipes like json minify, do data compression/decompression, base54-encode-decode, convert to and from hex, calculate hashes etc. </p>
<p>Bookmark/pin its page: <a href="https://gchq.github.io/CyberChef/">https://gchq.github.io/CyberChef/</a></p>
<h2>Local TOTP Generation</h2>
<p>If you want to generate totp from a secret locally, use <code>oath-toolkit</code> package. To generate totp:</p>
<div class="highlight"><pre><span></span><code>oathtool<span class="w"> </span>--base32<span class="w"> </span>--totp<span class="w"> </span><span class="s2">"SECRET"</span><span class="w"> </span>-d<span class="w"> </span><span class="m">6</span>
</code></pre></div>
<h2>More</h2>
<p>See my <a href="https://github.com/karambir/dotfiles">dotfiles</a> repo on GitHub to see helpful bash aliases and utilities I use daily.</p>My Desktop Linux setup as Developer2021-05-16T00:00:00+05:302021-05-16T00:00:00+05:30Karambir Singh Naintag:karambir.in,2021-05-16:/posts/desktop-linux-setup/<p>I am essentially a Backend Developer. I have been developing backends for websites and mobile apps for 7 years now. I have been using Linux as my daily driver since 2010. Previously it was exclusively Ubuntu and now it's mostly <a href="https://archlinux.org/">Arch Linux</a>. I try out <a href="https://pop.system76.com/">Pop OS</a> or recent Debian …</p><p>I am essentially a Backend Developer. I have been developing backends for websites and mobile apps for 7 years now. I have been using Linux as my daily driver since 2010. Previously it was exclusively Ubuntu and now it's mostly <a href="https://archlinux.org/">Arch Linux</a>. I try out <a href="https://pop.system76.com/">Pop OS</a> or recent Debian from time to time just to see how is the experience on those distros. Pop OS has been my recommendation for anyone wanting a good desktop solution that just works. Debian is my preferred distro for servers.</p>
<p>My main dev machine is Thinkpad T470. All the linux distros works well with <a href="https://www.lenovo.com/in/en/thinkpad">Lenovo Thinkpad</a> series. Though mine has hybrid graphics, I tend to use Intel graphics for most tasks. I install Arch manually and use KDE or Gnome on top. Both have pros and cons, and I jump between the two quite often. I like KDE better as personal desktop environment but Gnome works better with Wayland(for now, <a href="https://community.kde.org/KWin/Wayland">KDE devs are working hard</a>). I also like to keep only essential programs installed for me. Most of the programs which require deep integration with OS(like IDEs) are installed by Pacman(or apt for Ubuntu) and others by <a href="https://flatpak.org/">Flatpak</a>. I like how I can cleanly add or remove programs via Flatpak. Though security sandbox is gonna be biggest feature going forward. It is not there yet.</p>
<p>Here are the GUI programs I have on my machine most often:</p>
<ul>
<li>Firefox - Primary web browser</li>
<li>Ungoogled-Chromium - Secondary browser for stuff that just works on Chrome</li>
<li>VLC - Primary media player</li>
<li>LibreOffice - Office suite</li>
<li>Gparted - Robust partition manager</li>
<li>KDE or Gnome provided file manager(Nautilus/Dolphin), document viewer(Okular/Evince) and text editor(Gedit/Kate)</li>
<li>Visual Studio Code(FOSS version) - Primary text editor</li>
<li>Pycharm Professional - IDE for python programming language</li>
<li>Terminator - Primary terminal emulator with Gnome terminal and Konsole as backup</li>
<li>Thunderbird - Truly one of the best email application</li>
<li>Evolution - Calendar and Contact management via CardDAV and CalDAV standards</li>
<li>Shotwell - Image viewer</li>
<li>Cheese - Simple webcam app</li>
<li>Glimpse - Advanced image editor</li>
<li>Steam - For games</li>
<li>Handbrake - Video converter</li>
<li>OBS - Video recording software</li>
<li>Web services related apps like Nextcloud, Bitwarden, Zoom, Discord, Telegram and Spotify</li>
</ul>
<p>These cover almost everything I need to do with my computer.</p>
<p>For command-line, I do something similar. Have only core utilities and programs from pacman and use tools like pyenv, docker, nvm to use occassional packages or things that can pollute the system.</p>
<ul>
<li>neovim</li>
<li>Utilities like: tree, curl, htop, git, jq, s3cmd, duplicity, vnstat, nethogs</li>
<li>base-devel or build-essential(Ubuntu) for easily compiling other packages</li>
<li>pyenv - manage python installations and use them for python development</li>
<li>nvm - same for node</li>
<li><a href="https://github.com/pipxproject/pipx">pipx</a> - install adhoc python applications as executables in their isolated environments. This keeps the system python clean</li>
<li>configure bash and vim with my <a href="https://github.com/karambir/dotfiles">dotfiles</a></li>
</ul>
<p>Some folks use configuration management software like ansible or just bash scripts to set their desktop. As I install/change OS once every 18-24 months, I just do this manually. It takes around 2-3 hours to set everything up. I am currently happy with my setup and would like to make it even better. If you have any questions or want to share your thoughts about my linux setup, <a href="https://karambir.in/contact/">contact me</a>.</p>
<p>Desktop Linux has come a long way and it is a breeze working with it. I suggest you try it if you haven't already :)</p>Open Source Tools2017-09-05T00:00:00+05:302017-09-05T00:00:00+05:30Karambir Singh Naintag:karambir.in,2017-09-05:/posts/open-source-tools/<p>Since last year, I have tried not being dependent upon any single cloud provider for any of my personal data. Getting away from Google Ecosystem(mail, drive, calendar, contacts) and its seemless integration with Android is not easy.</p>
<p>With the help of many open-source projects and their amazing communities this …</p><p>Since last year, I have tried not being dependent upon any single cloud provider for any of my personal data. Getting away from Google Ecosystem(mail, drive, calendar, contacts) and its seemless integration with Android is not easy.</p>
<p>With the help of many open-source projects and their amazing communities this has been possible to an extent. Following are some of the projects that I use:</p>
<ul>
<li><a href="https://nextcloud.com">Nextcloud</a></li>
<li><a href="https://mailinabox.email/">Mailinabox</a></li>
<li><a href="https://davdroid.bitfire.at/">DavDroid Android</a></li>
<li><a href="https://github.com/netheril96/securefs">Securefs</a></li>
<li><a href="https://osmand.net/">OsmAnd</a></li>
</ul>
<p>And of course the underlying technologies used by these projects like Ubuntu, GPG, Git, OSM, PHP, MySQL, PostgreSQL, Nginx etc.</p>
<p>To all the contributors of these projects, I am truly grateful to you all.</p>Beginner's Guide to Open Source Software2012-10-03T00:00:00+05:302012-10-03T00:00:00+05:30Karambir Singh Naintag:karambir.in,2012-10-03:/posts/guide-to-open-source/<p>Many students complete their higher education in college without even
knowing what is open-source and how it can help them in their career.
They just want to develop for some for-profit company and earn some
money. But nowadays Open-Source is becoming a must for every Computer
Science student. </p>
<p>Following are …</p><p>Many students complete their higher education in college without even
knowing what is open-source and how it can help them in their career.
They just want to develop for some for-profit company and earn some
money. But nowadays Open-Source is becoming a must for every Computer
Science student. </p>
<p>Following are some of the frequently quesitons asked about Open Source
Software that may help you: </p>
<h2>What is Open Source?</h2>
<p><a href="http://en.wikipedia.org/wiki/Open_source">Quoting Wikipedia</a>:</p>
<blockquote>
<p>In production and development, <strong>open source</strong> is a philosophy or pragmatic
methodology that promotes free redistribution and access to an end product’s design and implementation details</p>
</blockquote>
<p>Open Source Software is the software which source code is available for
free to study, change, improve and at times also to distribute the
software.</p>
<h2>Why it is good for students?</h2>
<p>Students don’t get see code base of Windows OS or Microsoft Office. They
do not have a clue, how a proper software is developed and coded. They
have written some nifty programs and some small projects each semester,
but what about software that require collaboration of hundreds of
people, 1000 LOC. </p>
<p>Open Source Software gives all of this. They open their code base to be
used and studied. And if someone found they interesting enough to
collaborate, then they can. Anyone can file a bug report, feature code
to most of the Open Source Software(OSS). </p>
<p>When students interact with other developers on that project and write
code with them, they get a picture of how a well polished is written and
shipped, how testing is done. They read other people’s code and come
across different ways of expressions in software world.</p>
<p>Moreover when you write your own software and open source it, after
looking at it, people in community will contact you for business and
jobs. So its a Win-Win.</p>
<h2>How to find and contribute to Open Source Software?</h2>
<p>There are many well known projects that people will tell you about. But
start with something small, something you can get familiar with in small
time. Here is how you do it simple way (See Note below): </p>
<ol>
<li>Go to <a href="http://github.com/">Github</a> and search for a software in your
favourite programming language. </li>
<li>Select any project and clone it.</li>
<li>Use it, explore its code.</li>
<li>When you are using it, you may find some bug, file it on github. or</li>
<li>If you have feature in mind that can be implemented in that
software, add that.</li>
<li>When writing code, try to follow original developer’s style of
programming.</li>
<li>Push it and make a pull request.</li>
<li>There is more than 95% chance, that concerned developer will contact
in 48 hours.</li>
</ol>
<p>And you have made your first contribution to Open Source.</p>
<h2>Some popular Open Source Projects</h2>
<h4>Application software</h4>
<ul>
<li>7-Zip – file archiver</li>
<li>Blender – 3D graphics editor</li>
<li>Eclipse – development environment comprising an IDE</li>
<li>GIMP – graphics editor</li>
<li>Inkscape – Vector graphics editor for .svg</li>
<li>Mozilla Firefox – web browser</li>
<li>Chromium – web browser</li>
<li>Mozilla Thunderbird – e-mail client</li>
<li>NASA World Wind – virtual globe, geobrowser</li>
<li>OpenOffice.org (and the LibreOffice fork) – office suite</li>
<li>PrestaShop – Electronic commerce platform</li>
<li>ADempiere – (now Free Software forked from Compiere) an enterprise</li>
<li>resource planning (ERP) open source software platform for business</li>
<li>Vue – (Visual Understanding Environment) mind mapping software project of Tufts University</li>
</ul>
<h4>Operating systems</h4>
<ul>
<li>Android – operating system derived from Linux</li>
<li>FreeBSD – operating system derived from Unix</li>
<li>Linux – family of Unix-like operating systems</li>
<li>OpenIndiana – a free Unix-like operating system</li>
<li>ReactOS – operating system built on Windows NT architecture</li>
<li>Haiku – free and open-source operating system compatible with BeOS</li>
</ul>
<h4>Programming languages</h4>
<ul>
<li>Perl – a general purpose programming language</li>
<li>PHP – scripting language suited for the web</li>
<li>Python – general purpose programming language</li>
<li>Ruby – general purpose programming language</li>
<li>PHDL – hardware description language used for PC Board Design</li>
</ul>
<h4>Server software</h4>
<ul>
<li>Apache – HTTP web server</li>
<li>Drupal – content management system</li>
<li>MediaWiki – wiki server software, the software that runs Wikipedia</li>
<li>MongoDB – document-oriented, non-relational database</li>
<li>Moodle – course management system or virtual learning environment</li>
<li>WordPress – blog software</li>
<li>TYPO3 – enterprise content management system</li>
</ul>Thoughts about God2012-09-04T00:00:00+05:302012-09-04T00:00:00+05:30Karambir Singh Naintag:karambir.in,2012-09-04:/posts/thoughts-about-god/<p>Define God? Define the origin of this universe. Most religions talk
about god and our origin without telling much about the motive(they do
give some motive of our life, but not any reason as to why God created
us).When I think about time and how it governs our …</p><p>Define God? Define the origin of this universe. Most religions talk
about god and our origin without telling much about the motive(they do
give some motive of our life, but not any reason as to why God created
us).When I think about time and how it governs our universe, I come
straight to some questions:</p>
<ol>
<li>Is time a reality?</li>
<li>Is whole universe is governed by time or just our part?</li>
<li>Will time(as felt by us) be same in some other universe having some other physics laws?</li>
<li><strong>Is God tied in time?</strong></li>
</ol>
<p>For last question, my mind counters, Isn’t god, God? He must have
created time. So now I proceed with this fact- <strong>God is not tied in time anyhow</strong>.</p>
<p>So why he created this universe? Some
religion(<a href="http://en.wikipedia.org/wiki/Pantheism">Pantheism</a>,
<a href="http://en.wikipedia.org/wiki/Pandeism">Pandeism</a> and
<a href="http://en.wikipedia.org/wiki/Deism">Deism</a>) gives a picture that god
made this universe and don’t do anything with it. My question is why? Is
he just playing around to see how things would go, then he should know
it already because he is god(remember our fact). So why is this universe
here and how we get our conciousness(this topic has very good video in
“<a href="http://www.youtube.com/watch?v=l7E6sihLgdU">Through the wormhole” series in “Is there a life after Death” Episode</a>.</p>
<p>When I asked some of my friends, they said because God wants us to do
this, that… and pray to him. But why God wants to be prayed? He is not
human. He doesn’t have any sins that we humans have(humans have desires
).</p>
<p>Whereever I look to the defination of god, I found the defination,
characteristics and his intentions to be too humanistic(though many
religion says he cannot be imagined, reached or described by us). So
sometime i just tell myself that Every God related thing/arguement is
here because humans fear. We fear from unknown, from death, from
illness(myself included). We fear from our own imaginations(what happens
if questions). And then we need something to console us. And we
introduced the concept of God(whom we cannot describe, cannot imagine).
And who questions the deity who cannot be
described?</p>
<p>So concept of god may just be our imagination for our recounciltion in
bad times.</p>
<p>For me. I don’t know.</p>Reblog: Releasing our First MVP2012-04-30T00:00:00+05:302012-04-30T00:00:00+05:30Karambir Singh Naintag:karambir.in,2012-04-30:/posts/releasing-our-first-mvp/<p>Today was a big day. We launched our first MVP(Minimum Viable Product)
as a <a href="http://codesters.org/">Group</a>. We launched <a href="http://collegedive.in/">CollegeDiveIn</a>[ to our college. We have been working on this for over a month and getting
all things together, making them work, and then watching them break
every time and then again …</p><p>Today was a big day. We launched our first MVP(Minimum Viable Product)
as a <a href="http://codesters.org/">Group</a>. We launched <a href="http://collegedive.in/">CollegeDiveIn</a>[ to our college. We have been working on this for over a month and getting
all things together, making them work, and then watching them break
every time and then again building the whole was exciting. We first
talked about the structure of the website and the things which we will
cover. We brainstormed on everything we could think that can appeal to
college students in any
way.</p>The Power of Open Source2012-03-19T00:00:00+05:302012-03-19T00:00:00+05:30Karambir Singh Naintag:karambir.in,2012-03-19:/posts/power-of-open-source/<p>Recently I noticed that more and more developers and companies are
getting involved in Open Source and Open Source Projects. There are
Web-Frameworks, Web-apps, even New Operating Systems being written
Openly. This is not only good for the companies, people directly related
with the projects but also common people and …</p><p>Recently I noticed that more and more developers and companies are
getting involved in Open Source and Open Source Projects. There are
Web-Frameworks, Web-apps, even New Operating Systems being written
Openly. This is not only good for the companies, people directly related
with the projects but also common people and students who want to learn
and see how real projects are developed.</p>
<p>I see two very significant projects today which have the potential to
change our way of interaction with web:</p>
<ol>
<li>OpenStack:*<em> (From
Wikipedia)</em>[<a href="http://openstack.org/">OpenStack</a> is
an ]{}<a class="mw-redirect" href="http://en.wikipedia.org/wiki/IaaS" title="IaaS">IaaS</a>[ ]{}<a href="http://en.wikipedia.org/wiki/Cloud_computing" title="Cloud computing">cloud
computing</a>[ project
by ]{}<a href="http://en.wikipedia.org/wiki/Rackspace_Cloud" title="Rackspace Cloud">Rackspace
Cloud</a>[ and ]{}<a href="http://en.wikipedia.org/wiki/NASA" title="NASA">NASA</a>[.
Currently more than 150 companies have joined the project among which
are Citrix Systems, Dell, AMD, Intel, Canonical, SUSE Linux, HP,
and Cisco. It
is ]{}<a href="http://en.wikipedia.org/wiki/Free_software" title="Free software">free</a>[ ]{}<a href="http://en.wikipedia.org/wiki/Open_source" title="Open source">open
source</a>[ software
released under the terms of the ]{}<a href="http://en.wikipedia.org/wiki/Apache_License" title="Apache License">Apache
License</a></li>
</ol>
<p><strong>Why it is important?</strong></p>
<p>Because it can give us a platform that we can trust and own. We will
not be locked in with a vendor and can port our data anywhere. These
reasons may look small but these are features we need to have control on
our data. This is something that happened to Email in late 90s when we
were not forced to any vendor.</p>
<ol>
<li>Mozilla’s B2G(Boot to Gecko):** <a href="https://wiki.mozilla.org/B2G">B2G</a> is aimed at promoting
the open Web on mobile (and everywhere else). By using Web technologies
on software that never ran on them before (e.g. the phone dial-er),
technologies like HTML, JavaScript, and CSS are slated to move
forward.</li>
</ol>
<p><strong>Why it can affect?</strong></p>
<p>The reason is simple: It is web-based and developers will not need to
develop their Apps for one-more Stack. They have already announced that
any web-app can take advantage of Mobile’s features like messaging,
Bluetooth and call. It is very
impressive.</p>
<p>These are the projects that I think are biggest, most innovative and
that can really bring change to the Open-Web. But there are other
projects also that are supporting open source and would be beneficial
for all of us. Lets wait and see</p>Want to become a Codester2012-01-15T00:00:00+05:302012-01-15T00:00:00+05:30Karambir Singh Naintag:karambir.in,2012-01-15:/posts/become-a-codester/<p>Long time, no post! Well I was busy with some activities lately.
Creating a coders group called Codesters being top of it. I with some of
my college friends were wondering on how can we give our creative sides
a path and goal. How can we connect with Aspiring Coders …</p><p>Long time, no post! Well I was busy with some activities lately.
Creating a coders group called Codesters being top of it. I with some of
my college friends were wondering on how can we give our creative sides
a path and goal. How can we connect with Aspiring Coders and Hackers in
other colleges in India. So we came up with this idea and formed a
group.</p>
<p>We named it Codesters meaning Code Masters. Our main focus will be on
taking the love and passion of a computer science lover to next level by
sharing our knowledge and coding with each other. And in time if we can
have some idea that we think can solve a serious problem, then we will
make that project as a full App(also open to business opportunities).
We will be having meetups regularly at Gurgaon, India. Those who can’t
be present in person can connect through Google+ Hangouts(We love
them).</p>
<p>Well, the process of buying domain to forming rules and structure of
our group was thrilling. Following are the steps that we went through
while forming our group and its website:</p>
<ol>
<li>We met and discussed what our group will be about and its focus
areas. How we can make it interetsing and fun. The first thing which
I suggested was that our group will be open and all of its projects
will be open-sourced. All agreed. We discussed who we will first
approach for memberships - students in colleges and
schools.</li>
<li>Then we start discussing about the name of the group. Some
conditions were there, like it should not be too long and easily
pronounceable. We came up with many names but it should also be
available as a top-level domain. We were not getting any right
match; a name which can represent our Group and also be available.
We set out that none of us(Five of us) will get up until domain name
is finalized and registered. After half an hour of heavy discussion,
we reached at this name - Codesters. One of us was about to register
it on GoDaddy as he can get heavy discount there. I being read
about its actions lately(supporting SOPA in US) was against it. So
we registered our domain at BigRock.</li>
<li>
<p>We then talked about the memberships and how each member can
contribute to us. We laid out the structure of group with two type
of memberships:</p>
<ul>
<li>Code-hoppers : These are the students who loves technology and
programming. They like talking and discussing about ideas and
programming in general. These will recieve our daily dose of
some great happenings around the technology
areas.</li>
<li>Code-holics: Those who are absolutely mad code and softwares
will be this type.They will be asked for more contribution. They
will have to be present in meetups most of the
time.</li>
</ul>
</li>
<li>
<p>We made small website of our group and a membership form on Google
Docs. We decides to have all our code on Github and use Trello as a
project management between members.</p>
</li>
</ol>
<p>The process was exciting and result which we are satisfied. But its
just the beginning. Our version 1 of site is from a HTML5 template from
<a href="http://www.initializr.com/">Initializr</a>. Our version 2 is quite ready
at our <a href="http://codesters.org/alpha">Alpha version
page</a>.</p>
<p>Anyone interested in membership <a href="https://docs.google.com/spreadsheet/viewform?formkey=dG1teHhVNWMzSzBncUhGcnhINFF2Zmc6MQ">Click
here</a></p>