Skip to content

Instantly share code, notes, and snippets.

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;
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;
@atuljain
atuljain / solris_wkhtmltopdf
Created February 20, 2015 08:51
Install Wkhtmltopdf on Solaris
sudo pkgin se wkhtmltopdf
(This command will display latest wkhtmltopdf)
sudo pkgin install wkhtmltopdf<xxxxxxx>
sudo pkgin in fontconfig libXrender urw-fonts
@atuljain
atuljain / auth_ldap.py
Last active August 29, 2015 14:17
python and ldap authentication
# 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
@atuljain
atuljain / aws-multipartUpload.js
Created October 15, 2015 10:59 — forked from sevastos/aws-multipartUpload.js
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// 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;
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':
@atuljain
atuljain / sort_list_bin.py
Created June 23, 2016 04:39
Sort list by comparing the binary
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)
@atuljain
atuljain / description.txt
Last active September 30, 2016 06:48
oauth-integration-python
"""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':
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']:
@atuljain
atuljain / flask_csrf_test_client.py
Created July 16, 2018 10:51 — forked from singingwolfboy/flask_csrf_test_client.py
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!
# 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