This file contains hidden or 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 -y; | |
| sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit; | |
| sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools; | |
| cd ~; | |
| git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt; | |
| git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf; | |
| cd wkhtmltopdf; | |
| qmake-qt4; | |
| cd ../wkhtmltopdf-qt; | |
| git checkout 4.8.4; |
This file contains hidden or 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 -y; | |
| sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit; | |
| sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools; | |
| cd ~; | |
| git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt; | |
| git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf; | |
| cd wkhtmltopdf; | |
| qmake-qt4; | |
| cd ../wkhtmltopdf-qt; | |
| git checkout 4.8.4; |
This file contains hidden or 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 pkgin se wkhtmltopdf | |
| (This command will display latest wkhtmltopdf) | |
| sudo pkgin install wkhtmltopdf<xxxxxxx> | |
| sudo pkgin in fontconfig libXrender urw-fonts |
This file contains hidden or 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
| # to be able to import ldap run pip install python-ldap | |
| import ldap | |
| if __name__ == "__main__": | |
| ldap_server="127.0.0.1" | |
| username = "demo" | |
| password= "demo@password" | |
| # user_dn provided by the ldap server | |
| user_dn = "uid="+username+",ou=someou,dc=somedc,dc=local" | |
| # adjust this to your base dn for searching |
This file contains hidden or 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
| // Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload | |
| var fs = require('fs'); | |
| var AWS = require('aws-sdk'); | |
| AWS.config.loadFromPath('./aws-config.json'); | |
| var s3 = new AWS.S3(); | |
| // File | |
| var fileName = '5.pdf'; | |
| var filePath = './' + fileName; | |
| var fileKey = fileName; |
This file contains hidden or 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
| from gevent_zeromq import zmq | |
| from rest_framework.decorators import api_view | |
| import json | |
| import time | |
| from rest_framework.response import Response | |
| from django.http import HttpResponseNotFound | |
| @api_view(['POST']) | |
| def NOTIFICATION(request): | |
| if request.method == 'POST': |
This file contains hidden or 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 sys | |
| def int_to_bin(n): | |
| return '{0:04b}'.format(n) | |
| def findWholeWord(strM,w): | |
| return strM.count(w) | |
| def sortlist(list): | |
| x = len(list) |
This file contains hidden or 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
| """urls.py""" | |
| url(r'^$',views.root,name="root"), | |
| url(r'^home/$',views.home,name="home"), | |
| """views.py""" | |
| @api_view(['GET','POST']) | |
| def root(request): | |
| if request.method == 'GET': |
This file contains hidden or 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 os | |
| import datetime | |
| import logging | |
| import subprocess | |
| from shutil import make_archive | |
| logging.basicConfig(level=logging.INFO) | |
| def backup(args): | |
| today = datetime.datetime.now() | |
| for db in args['databases']: |
This file contains hidden or 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
| # Want to run your Flask tests with CSRF protections turned on, to make sure | |
| # that CSRF works properly in production as well? Here's an excellent way | |
| # to do it! | |
| # First some imports. I'm assuming you're using Flask-WTF for CSRF protection. | |
| import flask | |
| from flask.testing import FlaskClient as BaseFlaskClient | |
| from flask_wtf.csrf import generate_csrf | |
| # Flask's assumptions about an incoming request don't quite match up with |
OlderNewer