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
get_app_data: function() { | |
var self = this; | |
return $.when( | |
new db.web.Model("res.users").get_func("read")(this.session.uid, ['shop_id']).pipe(function(result) { | |
var shop_id = result['shop_id'][0]; | |
new db.web.Model("sale.shop").get_func("search_read")([['id','=',shop_id]],[]).pipe(function(result) { | |
self.set({'shop': result[0]}); | |
var company_id = result[0]['company_id'][0]; | |
return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id', 'name', 'phone']).pipe(function(result) { |
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
// Require.js allows us to configure shortcut alias | |
require.config({ | |
// The shim config allows us to configure dependencies for | |
// scripts that do not call define() to register a module | |
shim: { | |
'socketio': { | |
exports: 'io' | |
}, | |
'underscore': { | |
exports: '_' |
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
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) rar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; | |
*.tbz2) tar xvjf $1 ;; |
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 django import http | |
try: | |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS | |
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS | |
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS | |
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS | |
except AttributeError: | |
XS_SHARING_ALLOWED_ORIGINS = '*' |
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
babel>=0.9.6 | |
cherrypy==3.1.2 | |
formencode>=1.2.4 | |
mako>=0.4.1 | |
#pychart>=1.39 | |
pyyaml>=3.09 | |
egenix-mx-base>=3.2.0 | |
lxml>=2.3 | |
psycopg2>=2.4 | |
pydot>=1.0.25 |
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 urllib | |
import urllib2 | |
def paypal_check(tx,at): | |
success = False | |
post_data = [('cmd','_notify-synch'),('tx',tx),('at',at)] # a sequence of two element tuples | |
result = urllib2.urlopen('https://www.paypal.com/cgi-bin/webscr', urllib.urlencode(post_data)) | |
content = result.read().split('\n') | |
results = {} |
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
#Faster Low Quality result in mp4 | |
ffmpeg -i Before.Sunrise.DVDRip.XviD-SChiZO.avi -acodec libfaac -ab 128k -ar 44100 -vcodec mpeg4 -b 1000K -s 640x480 destination.m4v | |
#Better Quality result in mp4 | |
ffmpeg -i input.avi -f mp4 -y -vcodec libxvid -maxrate 1000k -mbd 2 -qmin 3 -qmax 5 -g 300 -bf 0 -acodec libfaac -ac 2 -flags +mv4 -trellis 2 -cmp 2 -subcmp 2 salida.mp4 |
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
#!/usr/bin/python | |
""" | |
Produces a Linux Netfilter u32 rule to match DNS requests for a given | |
domain name and/or a given query type. | |
Typical usage: | |
% python generate-netfilter-u32-rule.py --qname ripe.net --qtype ANY | |
Can be embedded in iptables' invocations for instance: | |
rule=$(python generate-rule.py args...) |
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
iptables --flush | |
iptables -A INPUT -p udp --dport 53 -m string --from 50 --algo bm --hex-string '|0000FF0001|' -m recent --set --name dnsanyquery | |
iptables -A INPUT -p udp --dport 53 -m string --from 50 --algo bm --hex-string '|0000FF0001|' -m recent --name dnsanyquery --rcheck --seconds 60 --hitcount 1 -j DROP | |
iptables -A INPUT -p udp --dport 53 -m u32 --u32 $(python generate-netfilter-u32-dns-rule.py --qname . --qtype ANY) -j DROP | |
#iptables -A INPUT -p udp --dport 53 -m u32 --u32 $(python generate-netfilter-u32-dns-rule.py --qname isc.org --qtype ANY) -j DROP | |
#iptables -A INPUT -p udp --dport 53 -m u32 --u32 $(python generate-netfilter-u32-dns-rule.py --qname isc.org. --qtype ANY) -j DROP | |
iptables -A INPUT -p udp --dport 53 -m string --from 50 --algo bm --hex-string '|0000FF0001|' -j DROP | |
#para bloquear ataque isc.org | |
iptables -A INPUT -p udp -m string --hex-string "|03697363036f726700|" --algo bm --to 65535 -j DROP |
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
public void mostrarToast(View view,String msj){ | |
Context context = view.getContext(); | |
CharSequence text = msj; | |
int duration = Toast.LENGTH_SHORT; | |
Toast toast = Toast.makeText(context, text, duration); | |
toast.show(); | |
} |