Skip to content

Instantly share code, notes, and snippets.

@manu-chroma
manu-chroma / getting fb username.py
Created February 11, 2016 19:13
note: mechanize doesn't support python 3
import mechanize
from bs4 import BeautifulSoup as bs
from getpass import getpass
#USER CREDENTIALS
email = raw_input("email: ")
password = getpass("password: ")
#GETTING SOURCE CODE
browser = mechanize.Browser()
@manu-chroma
manu-chroma / getting fb username(2).py
Created March 2, 2016 18:16
using robobrowser and beautiful soup. Supports both python 2.7 and 3
from robobrowser import RoboBrowser
from getpass import getpass
from bs4 import BeautifulSoup as bs
browser = RoboBrowser(history=True)
browser.open('https://m.facebook.com/')
# GETTING INPUT
mail = input('Email : ')
password = getpass('Password : ')
@manu-chroma
manu-chroma / nginxproxy.md
Created March 17, 2016 21:39 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

To setup NGINX server && Securing it with Let's Encrypt

Part 1: Setting up NGINX server

Run this script to setup a working NGINX server proxying requests to the gunicorn server.

NOTES

  1. The script should run with sudo privilages.
  2. Running the script: sudo bash nginx_deploy.sh
  3. There must be a NGINX server config file should already present be present in the directory.
  4. Sample config file used: server_start
@manu-chroma
manu-chroma / gist:4bc34ce39452cc47855aade121baca29
Created April 2, 2016 16:14 — forked from ryanuber/gist:9014174
Vagrant re-import box from files on local system

If you find that vagrant box list somehow does not contain a box you previously had, you can sometimes add the box back if you still have the sources for it in ~/.vagrant.d/boxes.

$ cd ~/.vagrant.d/boxes/precise64/0/virtualbox/
$ tar czf ~/precise64.box .
$ vagrant box add precise64 ~/precise64.box 
Downloading box from URL: file:/Users/ryanuber/precise64.box
Extracting box...te: 417M/s, Estimated time remaining: --:--:--)
Successfully added box 'precise64' with provider 'virtualbox'!
@manu-chroma
manu-chroma / .gitconfig
Created September 24, 2016 17:21 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@manu-chroma
manu-chroma / pr.md
Created October 4, 2016 18:43 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

(zenodo) manu@hp:~/src/zenodo$ ./scripts/setup-assets.sh
/home/manu/Envs/zenodo/local/lib/python2.7/site-packages/dojson/contrib/to_marc21/model.py:22: UserWarning: MARC21 undo feature is experimental
  warnings.warn('MARC21 undo feature is experimental')
[2017-03-13 20:00:25,032] ERROR in app: Failed to initialize entry point: invenio_deposit_rest = invenio_deposit:InvenioDepositREST
Traceback (most recent call last):
  File "/home/manu/Envs/zenodo/bin/zenodo", line 11, in <module>
    load_entry_point('zenodo', 'console_scripts', 'zenodo')()
  File "/home/manu/Envs/zenodo/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
@manu-chroma
manu-chroma / cwltool failing test in py3.md
Last active June 19, 2017 19:36
tests/test_ext.py::TestListing::test_listing_deep
/home/manu/github/cwltool/venv3/bin/python3.5 /home/manu/Downloads/pycharm-2016.3.2/helpers/pydev/pydevd.py --multiproc --qt-support --client 127.0.0.1 --port 36690 --file /home/manu/github/cwltool/setup.py test
pydev debugger: process 19584 is connecting

Connected to pydev debugger (build 171.4163.6)
running pytest
Searching for mock>=2.0.0
Best match: mock 2.0.0
Processing mock-2.0.0-py3.5.egg