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
# coding=utf-8 | |
from django.template.context_processors import csrf | |
from django.views.generic import TemplateView | |
class TemplateViewWithCsrf(TemplateView): | |
""" | |
This set the csrf which could be called by the Django template | |
""" | |
def get(self, request, *args, **kwargs): | |
context = self.get_context_data(**kwargs) |
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
# coding=utf-8 | |
import re | |
from lxml import etree | |
import requests | |
__author__ = 'namh' |
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
package com.hbwhale.seedmoney.tabs; | |
import android.Manifest; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.net.Uri; | |
import android.os.Build; |
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
from subprocess import Popen, PIPE | |
# This is the exact same as running: ls -al | sort | |
p1 = Popen(["ls", "-al"], stdout=PIPE) | |
p2 = Popen(["sort"], stdin=p1.stdout, stdout=PIPE) | |
output = p2.communicate()[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
def iterxlsx(sheet, startRow=0): | |
row = startRow | |
nrows = sheet.nrows | |
ncols = sheet.ncols | |
while row < nrows: | |
col = 0 | |
colvals = [] | |
while col < ncols: |
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
//------------------------------------------------ | |
// | |
// Gruntfile.js | |
// | |
//------------------------------------------------ | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ |
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 ipdb; ipdb.set_trace() |
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 requests | |
from pyquery import PyQuery | |
headers = { | |
'user-agent': "Mozilla/5.0 (Windows NT 6.1) " | |
"AppleWebKit/537.36 (KHTML, like Gecko) " | |
"Chrome/50.0.2661.87 Safari/537.36" | |
} | |
baseUrl = "http://google.com" |
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
Show hidden characters
// sublime project configuration file | |
{ | |
"folders": | |
[ | |
{ | |
"file_exclude_patterns": | |
[ | |
"*.gitignore", |
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
from math import exp, pi | |
class NaiveBayes: | |
def __init__(self): | |
self.labels = [] | |
self.stat_labels = {} | |
self.numof_instances = 0 | |
self.attributes = [] | |
self.attvals = {} |
OlderNewer