SELECT MAX(id) FROM your_table;
SELECT nextval('your_table_id_seq');
SELECT setval('your_table_id_seq', (SELECT MAX(id) FROM your_table));
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
pip install pycurl
from transloadit/python-sdk#4 @ifedapoolarewaju
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
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; |
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
# 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: |
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 | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummy-web-server.py [<port>] | |
Send a GET request:: | |
curl http://localhost |
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
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!', |
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
# 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 |
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.
Cribbed from my notes and this blog post.
NewerOlder