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
<body> | |
<div id="dropzone"> | |
<h1>Drop files here 2</h1> | |
<p>To add them as attachments</p> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> |
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
# | |
# by default, django 404 and 500 pages dont pass context to templates. | |
# as you almost *always* need context variables in your custom | |
# 404/500 templates, you might need MEDIA_URL for example | |
# | |
# you need to create a custom view for errors and register it in your urls.py | |
# | |
# in urls.py add : | |
# | |
# handler500 = handler404 = views.server_error |
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
alert("Hello, world"); |
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/python | |
# | |
# | |
# use pygooglecharts from http://pygooglechart.slowchop.com/ | |
# | |
# just pipe rsnapreport.pl to this python script to get beautiful graphs with rsnapshot statistics | |
# send the email report as HTML to get your graphs embedded | |
# | |
# example crontab : | |
# 0 23 * * * root /usr/bin/rsnapshot daily 2>&1 | /home/juju/scripts/rsnapreport.pl | python /home/juju/scripts/rsnapshot-graphs.py | sendmail -t |
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
// | |
// when this script is inserted in your pages (with jQuery) | |
// you can send a initPage querystring parameter to control the page display | |
// what you send in initPage is executed with jQuery | |
// | |
// eg : send a link to this page, but with some dynamic modifications to someone (form filled...) | |
// | |
// example send : | |
// // this fill an input and check a box on the page | |
// initPage=[{selector:'input#testinput', method:'val',value:'Hello, World'}, {selector:'form[name=form1] input[name=check1]', method:'attr',value:['checked', true]} |
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
/* | |
1) include this script in your page <script language="javascript" src="https://gist.github.com/raw/843632/loadFromGET.js"></script> | |
2) send a ?jsinit=http://domain/path/to/file.js | |
=> JS will be executed onload | |
*/ | |
// querystring parser | |
function gup(name) | |
{name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null) |
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
// LZW-compress a string | |
function lzw_encode(s) { | |
var dict = {}; | |
var data = (s + "").split(""); | |
var out = []; | |
var currChar; | |
var phrase = data[0]; | |
var code = 256; | |
for (var i=1; i<data.length; i++) { | |
currChar=data[i]; |
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
function buildForm(a,e,c,d){if(!d){d=""}var b="<form id='form-"+d+"' method='"+e+"' action='"+a+"' target='"+d+"'>";b+='<input type="hidden" name="cb" value="alert"/>';for(i in c){if(c.hasOwnProperty(i)){b+='<input type="hidden" name="'+i+'" value="'+c[i]+'"/>'}}b+="</form>";return b}function createIframe(b){var a="<iframe id='"+b+"' name='"+b+"' width=1000 height=400 src='about:blank'></iframe>";document.body.innerHTML+=a}function postForm(a,e,b,c){var d="postForm";if(!c){c="iframe-"+d}if(!document.getElementById(c)){createIframe(c)}f=buildForm(a,e,b,c);if(!document.getElementById("postForm-container")){document.body.innerHTML+="<div id='postForm-container'></div>"}document.getElementById("postForm-container").innerHTML=f;document.getElementById("form-"+c).submit()}; |
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 os | |
from PIL import Image | |
def extractFrames(inGif, outFolder): | |
frame = Image.open(inGif) | |
nframes = 0 | |
while frame: | |
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF') | |
nframes += 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/python | |
# | |
# Author : Julien Bouquillon ([email protected]) - revolunet team | |
# | |
# this munin plugin generate graphs with evolution of all registered django models | |
# install : copy, chmod +x then ln -s in /etc/munin/plugins | |
# | |
# project root | |
import sys |
OlderNewer