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
{% load url from future %} | |
<link href="{{ STATIC_URL }}css/facebook.css" type="text/css" rel="stylesheet" media="all" /> | |
{% include 'django_facebook/_facebook_js.html' %} | |
Register! | |
<form action="{% url 'facebook_connect' %}?facebook_login=1" method="post"> | |
<a href="javascript:void(0);" style="font-size: 20px;" onclick="F.connect(this.parentNode);">Login or register with facebook</a> | |
<input type="hidden" value="{% url 'my_post_registration_url' %}" name="register_next" /> |
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
# pip is a tool for installing Python packages. | |
sudo easy_install pip | |
# Essential tools for any self-respecting Python programmer. | |
sudo pip install virtualenv virtualenvwrapper ipython | |
# This is where we keep Python environments. | |
mkdir ~/.virtualenvs | |
# Set up our shell for virtualenvwrapper. |
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
# custom alias | |
alias free="free -m" | |
alias cls="clear" | |
alias l="ls -lrt" | |
alias update="sudo apt-get update" | |
alias install="sudo apt-get install" | |
alias upgrade="sudo apt-get dist-upgrade" | |
alias remove="sudo apt-get remove" | |
alias reboot="sudo reboot" | |
alias shutdown="sudo shutdown -h now" |
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
web: gunicorn wsgi:app -b 0.0.0.0:$PORT -w 3 -k gevent --max-requests 250 |
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 wsgiref.simple_server import make_server | |
import static | |
app = static.Cling('_site') | |
def main(): | |
make_server('localhost', 8000, static.Cling('_site')).serve_forever() | |
if __name__=='__main__': | |
main() |
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
package edu.upittc.training; | |
import javax.swing.JOptionPane; | |
public class ArrayTest { | |
public static int max(int[] x){ | |
//get max integer in array | |
int max = x[0]; | |
for(int i=0;i<x.length;i++){ |
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 class Inv | |
{ | |
public static int array_inversion_count(int array[]) | |
{ | |
int inversion_counter = 0; | |
for(int p=0;p<array.length;p++) | |
{ | |
for(int q=0;q<array.length;q++) | |
{ |
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
/* http://rosettacode.org/wiki/Equilibrium_index | |
* Assume the sum of zero element is equal to zero. Write a function | |
* that given a sequence, returns its equilibrium index (any) or -1 | |
* if no equilibrium indexes exist. Assume that the sequence may be very long. | |
*/ | |
public class Equi { | |
private int array[]; | |
private int index; | |
public Equi(int array[]){ |
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
class Beer { | |
/* Prints the lyrics of "99 Bottles of Beer" */ | |
public static void lyrics(int bottles){ | |
if(bottles == 0){ | |
System.out.println(); | |
System.out.println("No bottles of beer on the wall, no bottles of beer, ya' can't take one"); | |
System.out.println("down, ya' can't pass it around, 'cause there are no more bottles of beer on the wall!"); | |
} else { | |
System.out.println(bottles + " bottles of beer on the wall," + bottles + " bottles of beer, ya' take one"); |
NewerOlder