Skip to content

Instantly share code, notes, and snippets.

View mobilestack's full-sized avatar

Tony mobilestack

View GitHub Profile

In my quest to learn how to use python within the django framework, the most difficult thing was the development environment, and getting to the point where I could play learn, practice and experiment. Here are some steps that I took to get to that point.

I’ll add to this as I can, but mostly I’m using it as a handy resource that I can access while continuing to learn.

SETUP DJANGO PROJECT IN MY MAC OS DEV ENV

Cribbed from my notes and this blog post.

@mobilestack
mobilestack / install onavo
Last active September 16, 2016 18:22
安装onavo的方法
http://tieba.baidu.com/p/2793623486 这里去找链接,输入到safari即可,即使没有下载onavo软件也可以
http://mobile.163.com/13/1218/00/9GB92A1C0011671M.html 这里去配置
# You will need to run these with superuser permissions.
# Either prefix `sudo` to all commands, or switch user
# Be very careful when you switch user
sudo su - root
# Update all the packages
yum update
# Install the basics - python27, gcc, svn, git, httpd, make, uuid
@mobilestack
mobilestack / apns.py
Created November 12, 2016 13:41 — forked from scotttam/apns.py
Sends an Apple Push Notification with Python
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
@mobilestack
mobilestack / dummy-web-server.py
Created September 1, 2017 07:20 — forked from bradmontgomery/dummy-web-server.py
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.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@mobilestack
mobilestack / ecc.py
Created January 14, 2018 06:28 — forked from bellbind/ecc.py
[python]basics of elliptic curve cryptography
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
def inv(n, q):
"""div on PN modulo a/b mod q as a * inv(b, q) mod q
>>> assert n * inv(n, q) % q == 1
"""
for i in range(q):
if (n * i) % q == 1:
@mobilestack
mobilestack / nginx.conf
Created April 29, 2018 03:35 — forked from revant/nginx-files.conf
Frappe CORS for nginx
location @webserver {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
@mobilestack
mobilestack / pyspider_install_fix.md
Last active July 16, 2018 15:28
pyspider installation with pycurl ssl problem

pip uninstall pycurl

export PYCURL_SSL_LIBRARY=openssl

pip install pycurl

from transloadit/python-sdk#4 @ifedapoolarewaju

@mobilestack
mobilestack / postgresql id_seq reset.md
Last active August 14, 2018 21:33
postgresql id_seq reset

SELECT MAX(id) FROM your_table; SELECT nextval('your_table_id_seq'); SELECT setval('your_table_id_seq', (SELECT MAX(id) FROM your_table));

@mobilestack
mobilestack / chatpdf-zh.ipynb
Created March 25, 2023 11:14 — forked from ninehills/chatpdf-zh.ipynb
ChatPDF-zh.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.