Skip to content

Instantly share code, notes, and snippets.

@alokm
alokm / grep for text in dir
Created January 30, 2012 20:53
grep for specific text in a directory recursively
To search for text in files from the current folder (or directory, to follow Linux nomenclature), one can write:
grep "text" -R . -n --include=*.py
The parameters are as follows:
text the actual text to search for
-R Recurse to subdirectories
. start from the current directory
–include=*.py specifies a regular expression that searchable files must match (e.g. *.py)
@alokm
alokm / virtualenv_intro.md
Created February 4, 2012 02:50
A Gentle Introduction to Python Library Management with Virtualenv

Introduction

Virtualenv is a tool to build isolated Python environments. It's a great way to quickly test new libraries without cluttering your global site-packages or run multiple projects on the same machine which depend on a particular library but not the same version of the library.

You can, for example, install version X of a library in one environment and version Z of the same library in another environment, without one interfering the other. Each environment provides its own Python executable and site-packages directory (which is not shared between environments).

Quickstart Command Sampler

$ easy_install virtualenv

List of logical fallacies - source:yourlogicalfallacyis.com
strawman - you misrepresent someone's argument to make it easier to attack
false cause - you presumed that a real or perceived relationship between things means that one is the cause of the other
appeal to emotion - you attempted to manipulate an emotional response in place of a valid or compelling argument
ad hominem - you attacked your opponen's character or personal traits in an attempt to undermine their argument
@alokm
alokm / how_to_boot_usb.org
Last active October 27, 2018 16:35
How to make a bootable usb from iso in Linux
@alokm
alokm / CSVify.py
Last active February 24, 2019 20:55
CSVify.py converts a space delimited input file into a comma delimited output file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CSVify converts a space delimited text file to csv and saves it
# with a .csv extension.
def csvify(infilename, outfilename):
with open(outfilename, 'w') as outfile:
with open(infilename, 'r') as infile:
for line in infile.readline():
@alokm
alokm / README.md
Created July 29, 2019 02:16
Solvo installation instructions

Introduction

This application is designed to serve as a self-contained backend service providing a non-linear multi-dimensional equation solver.

Installation

Pre-Requisites

  • a computer running Linux, WSL for Windows or Unix for MacOS
  • terminal access to a bash shell
Install dependencies for building Python 3.7.x source
$ sudo apt update -y
$ sudo apt install -y software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.7
@alokm
alokm / logs.txt
Created August 10, 2019 01:59
solvo-base-api heroku logs
(solvo_base_api) bash-3.2$ heroku logs --tail
2019-08-09T03:41:59.397413+00:00 app[web.1]: reraise(type(exception), exception, tb=exc_tb, cause=cause)
2019-08-09T03:41:59.397415+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise
2019-08-09T03:41:59.397417+00:00 app[web.1]: raise value.with_traceback(tb)
2019-08-09T03:41:59.397426+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
2019-08-09T03:41:59.397428+00:00 app[web.1]: cursor, statement, parameters, context
2019-08-09T03:41:59.397430+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
2019-08-09T03:41:59.397431+00:00 app[web.1]: cursor.execute(statement, parameters)
2019-08-09T03:41:59.397433+00:00 app[web.1]: sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "model" does not exist
2019-08-09T03:41:59.397435+
{
"meta": {
"name": "System-1",
"ready": false,
"error": ""
},
"equations": [
{
"text": "x^2 + y^2 = z^2",
"disabled": false,
@alokm
alokm / file.txt
Last active September 19, 2019 02:12
Valid Solvo input
// url = 'https://solvo-api.herokuapp.com/api/v1/update'
{
"meta": {
"name": "System-1",
"path": "files/file-1.yml",
"ready": false,
"error": ""