Skip to content

Instantly share code, notes, and snippets.

basic html structure

<!DOCTYPE html>
<html lang="en">
<head>
...
! <tab>
In [1]: def hi(): 
   ...:     yield 'jack' 
   ...:     yield 'bob' 
   ...: 
  
In [2]: hi()                                                                    
Out[2]: <generator object hi at 0x7ff64a27c0b0>

In [11]: h = hi() 

task

  • copy contents of /var/www/html to /data

install

apt-get install bacula -y

create backup directory

Lesson 1: Building Foundational Python Skills for Data Analytics

Getting Setup

Setup a virtual environment:

$ python3.6 -m venv modernpython
$ source modernpython/bin/activate

sorting

const numbers = [43, 56, 33, 23, 44, 36, 5];

val = numbers.sort()
// [ 23, 33, 36, 43, 44, 5, 56 ]

// use a compare function and pass it as a callback
val = numbers.sort(function(x, y){
open in firewall
On client:
# nc -vz 192.168.1.29 80
Connection to 192.168.1.29 80 port [tcp/http] succeeded!
On server:
# nc -vl 192.168.1.29 80
Connection from 192.168.1.28 port 80 [tcp/http] accepted
create table temp(t int);
insert into temp(t) select random()*100 select from generate_series(0, 1000000);
sync
- client waits until primary data replicated to at least one secondary
aysnc
- client is done once data is in primary

Chapter 4. Building a Blog

Model Forms

class PostForm(ModelForm):
    class Meta:
        model = Post

Chapter 3. Building a Pastebin

In this chapter we will be designing a simple pastebin. Our pastebin will be able to

  • Allow users to paste some text
  • Allow users to edit or delete the text
  • Allow users to view all texts
  • Clean up texts older than a day

Some ‘views’ that the user will see are

  • A list view of all recent texts