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
func WaitGroupDemo() { | |
var wg sync.WaitGroup | |
var urls = []string{ | |
"http://www.golang.org/", | |
"http://www.google.com/", | |
"http://www.somestupidname.com/", | |
} | |
for _, url := range urls { | |
// Increment the WaitGroup counter. | |
wg.Add(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 ubuntu:trusty | |
MAINTAINER Krator <[email protected]> | |
RUN (echo "deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list && echo "deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list && echo "deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list && echo "deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list) | |
RUN apt-get update && apt-get install -y \ | |
sqlite3 \ | |
python3-pip \ | |
--no-install-recommends && rm -rf /var/lib/apt/lists/* |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | |
<appender name="console" class="org.apache.log4j.ConsoleAppender"> | |
<param name="Target" value="System.out"/> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/> | |
</layout> | |
</appender> |
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
# This is a demo for merge sort | |
# Coded according to pseudocode from Introduction.to.Algorithm | |
INF = float('inf') | |
def merge(lst, p, q, r): | |
left = lst[p:q + 1] | |
left.append(INF) | |
right = lst[q + 1:r + 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
# models.py | |
from django.db import models | |
class Blog(models.Model): | |
user = models.ForeignKey(settings.AUTH_USER_MODEL) | |
title = models.CharField(max_length=255) | |
content = models.TextField() | |
# forms.py |