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
for row in MyModel.objects.all(): | |
if MyModel.objects.filter(photo_id=row.photo_id).count() > 1: | |
row.delete() |
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
.vertical-offset-100{ | |
padding-top:100px; | |
} |
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
$ pip install django-extensions | |
#These libraries are necessary before you proceed. | |
$ sudo apt-get install graphviz | |
$ sudo apt-get install graphviz-dev | |
#add django-extensions in project settigns.py |
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
# Create your views here. | |
from django.shortcuts import render,redirect | |
from django.contrib.auth import authenticate | |
from datetime import datetime | |
import hmac | |
def ticket_login(request): | |
if request.method == 'GET': | |
return render(request, 'ticketing/login.html') |
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
(do (println "Enter a number") | |
(let [num (read-string (read-line))] | |
(println (str "you" "entered" num)) | |
) | |
) |
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
#!/bin/sh | |
echo "updating ubuntu" | |
sudo apt-get -qq update | |
sudo apt-get -qq upgrade | |
# development | |
echo "installing development tools" | |
sudo apt-get -qq install build-essential |
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 datetime import datetime, timedelta | |
import sys,requests,pprint | |
sys.path.append('/home/naren/Downloads/vtwsclib/Vtiger') | |
from WSClient import * | |
class KnowTiger(object): |
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 pygal | |
from flask import Flask, Response | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): |
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
# Sieve of Eratosthenes, docstrings coming in Julia 0.4 | |
function es(n::Int64) # accepts one 64 bit integer argument | |
isprime = ones(Bool, n) # n-element vector of true-s | |
isprime[1] = false # 1 is not a prime | |
for i in 2:int64(sqrt(n)) # loop integers from 2 to sqrt(n), explicit conversion to integer | |
if isprime[i] # conditional evaluation | |
for j in (i*i):i:n # sequence from i^2 to n with step i | |
isprime[j] = false # j is divisible by i | |
end | |
end |
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 iprimes_upto(limit): | |
is_prime = [False] * 2 + [True] * (limit - 1) | |
for n in xrange(int(limit**0.5 + 1.5)): # stop at ``sqrt(limit)`` | |
if is_prime[n]: | |
for i in range(n * n, limit + 1, n): # start at ``n`` squared | |
is_prime[i] = False | |
for i in xrange(limit + 1): | |
if is_prime[i]: yield i |
OlderNewer