URL | HTTP Verb | Action |
---|---|---|
/photos/ | GET | index |
/photos/new | GET | new |
/photos | POST | create |
/photos/:id | GET | show |
/photos/:id/edit | GET | edit |
/photos/:id | PATCH/PUT | update |
/photos/:id | DELETE | destroy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kill -9 $(ps aux | grep 'uwsgi' | awk '{print $2}') | |
source /home/ubuntu/.env/myappenv/bin/activate | |
cd /home/ubuntu/myapp | |
kill -9 $(ps -aux | grep 'worker.py' | awk '{print $2}') | |
nohup redis-server & | |
nohup python -u worker.py > worker.out & | |
uwsgi --socket :8881 --plugin python --wsgi-file main.py --callable app --buffer-size 32768 --process 4 --logto /home/ubuntu/myapp/log/myapp.log & | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Thanks to Dan Jacob for a part of the code ! | |
from flask import Flask, send_file | |
import StringIO | |
app = Flask(__name__) | |
@app.route('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1, width=device-width"> | |
<meta name="keywords" content="Chirag, Chamoli, Python, Django, Javascript, PHP, Startup, Product Dev" /> | |
<title>Chirag Chamoli - python and JavaScript programmer and enterprise software lover. </title> | |
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet"> | |
<meta name="description" content="Technical Architect | Full Stack (Python/Javascript) | Data Science | Machine Learning and AI | Ex-500 Startups" /> | |
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"event": "payment.authorized", | |
"entity": "event", | |
"contains": [ | |
"payment" | |
], | |
"payload": { | |
"payment": { | |
"entity": { | |
"id": "pay_6X6jcHoHdRdy79", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Thanks to Dan Jacob for a part of the code ! | |
from flask import Flask, send_file | |
import StringIO | |
app = Flask(__name__) | |
@app.route('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install git-core | |
git clone https://chiragedyst@bitbucket.org/edyst2/api-server.git | |
cd api-server/ | |
sudo apt-get install python-pip | |
git pull | |
sudo apt-get install nginx supervisor python-virtualenv | |
virtualenv venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toMarkdown = function(string) { | |
var ELEMENTS = [{ | |
patterns: 'p', | |
replacement: function(str, attrs, innerHTML) { | |
return innerHTML ? '\n\n' + innerHTML + '\n' : ''; | |
} | |
}, { | |
patterns: 'br', | |
type: 'void', | |
replacement: '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls | |
sudo apt-get install apache2 | |
sudo apt-get update | |
sudo apt-get install libapache2-mod-wsgi | |
sudo apt-get install python-flask | |
sudo apt-get upgrade | |
apt-get install git-core | |
sudo apt-get install git-core | |
ls | |
cd /var/www/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl req -x509 -out localhost.crt -keyout localhost.key \ | |
-newkey rsa:2048 -nodes -sha256 \ | |
-subj '/CN=localhost' -extensions EXT -config <( \ | |
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") |