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 rss | |
import "encoding/xml" | |
// NonNamespaceString is a special kind of string. When unmarshal'ed it | |
// will only unmarshal when there is no namespace. | |
// For more details, see: https://github.com/golang/go/issues/8535 | |
type NonNamespaceString string | |
func (s *NonNamespaceString) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { |
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
type RandomRendererFactory struct { | |
Max int | |
Min int | |
} | |
func NewRandomRendererFactory(min, max int) RandomRendererFactory { | |
return RandomRendererFactory{Min: min, Max: max} | |
} | |
func (f RandomRendererFactory) TextRenderer(text string) TextRenderer { |
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 main | |
import ( | |
"time" | |
ui "github.com/gizak/termui" | |
) | |
func main() { | |
err := ui.Init() |
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
class User (models.Model): | |
name = models.CharField(max_length=255) | |
class Manager (models.Model): | |
registration = models.PositiveInteger() | |
name = models.CharField(max_length=255) | |
class ClientHistory (models.Model): |
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
#!/usr/bin/env python3.4 | |
import argparse | |
import sys | |
import subprocess | |
class ErrorToleranteParser(argparse.ArgumentParser): | |
def error(self, message): | |
sys.stderr.write("error: {}\n".format(message)) | |
self.print_help() |
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
Using `unittest.main()`: | |
python tests.py -b | |
.F | |
Stdout: | |
Should be printed since this test failed. | |
====================================================================== | |
FAIL: test_print (__main__.TestSequenceFunctions) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): |
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
failed=false | |
total=1000 | |
for i in $(seq ${total}); do | |
printf "Status: ${i}/${total}\r" | |
psql --user "Matt3o12" --no-password --host="localhost" --port=5432 --dbname="Matt3o12" -c "" || failed=true | |
if [ "$failed" = true ]; then | |
echo "Error after attempt ${i}." | |
exit 1 | |
fi |
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
failed=false | |
total=1000 | |
for i in $(seq ${total}); do | |
printf "Status: ${i}/${total}\r" | |
psql --user "Matt3o12" --no-password --host="localhost" --port=5432 --dbname="Matt3o12" -c "" || failed=true | |
if [ "$failed" = true ]; then | |
echo "Error after attempt ${i}." | |
exit 1 | |
fi |
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 timeit; | |
import psycopg2 | |
def psy(): | |
with psycopg2.connect(user="Matt3o12", password="", host="localhost", port=5432, database="Matt3o12") as conn: | |
pass | |
if __name__ == "__main__": | |
i = 0 | |
try: |
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 timeit; | |
import psycopg2 | |
def psy(): | |
with psycopg2.connect(user="Matt3o12", password="", host="localhost", port=5432, database="Matt3o12") as conn: | |
pass | |
if __name__ == "__main__": | |
i = 0 | |
try: |
NewerOlder