Skip to content

Instantly share code, notes, and snippets.

Rocckk /
Created February 2, 2020 14:07 — forked from subfuzion/
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

Rocckk /
Created October 8, 2019 14:55 — forked from reidransom/
Returning binary data from a Django view
from django.http import HttpResponse
def django_file_download_view(request):
filepath = '/path/to/file.xlsx'
with open(filepath, 'r') as fp:
data =
filename = 'some-filename.xlsx'
response = HttpResponse(mimetype="application/ms-excel")
response['Content-Disposition'] = 'attachment; filename=%s' % filename # force browser to download file
Rocckk / py_cx_ora_dates
Created September 24, 2019 14:41
Working with dates and timestamps using python and cx_oracle. Prefer to_date and to_timestamp with format strings. Don't like the alter session option. Some folks described problems with unicode so I added the unicode strings.
View py_cx_ora_dates
#! /bin/python
import cx_Oracle
import platform
print ("Python version: " + platform.python_version())
print ("cx_Oracle version: " + cx_Oracle.version)
print ("Oracle client: " + str(cx_Oracle.clientversion()).replace(', ','.'))
connection = cx_Oracle.connect('user/pass09@tns')
cursor = connection.cursor()
Rocckk /
Created August 14, 2019 11:23 — forked from rg3915/
Generate graphic model Django with PyGraphViz

How to generate graphic model Django with PyGraphViz?

sudo apt-get install graphviz libgraphviz-dev pkg-config
virtualenv -p python2.7 .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pygraphviz
pip uninstall pyparsing
pip install -Iv
Rocckk /
Created April 1, 2019 15:17 — forked from bradmontgomery/
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
Very simple HTTP server in python.
./ [<port>]
Send a GET request::
curl http://localhost
Rocckk /
Created March 12, 2019 16:50 — forked from bsingr/LICENSE.txt
http json echo server written in python3
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse
import json
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = urlparse(self.path)