psql -U postgres -c 'SHOW config_file'
log_statement = 'none' # none, ddl, mod, all
class Blog(django.model): | |
name = models.CharField(null=False, max_length=64) | |
def list_articles(self): | |
return [ | |
{'body': 'abcdefg'}, | |
{'body': 'abcdefg'}, | |
{'body': 'abcdefg'}, | |
] |
import json | |
import re | |
filename = './swedish.txt' | |
print('Start reading') | |
dictionary = {} | |
with open(filename, encoding="utf-8") as file: | |
while line := file.readline(): | |
line = line.rstrip().split(' ') |
use std::collections::HashSet; | |
fn is_anagram(word: &str, candidate: &str) -> bool { | |
if word.to_lowercase() == candidate.to_lowercase() { | |
return false; | |
} | |
let mut a = word.to_lowercase().chars().collect::<Vec<char>>(); | |
let mut b = candidate.to_lowercase().chars().collect::<Vec<char>>(); | |
a.sort(); | |
b.sort(); |
from PIL import Image | |
img = Image.open("star.jpg") | |
pixels = img.rotate(90).load() | |
density = "Ñ@#W$9876543210?!abc;:+=-,._ " | |
for i in range(img.size[0]): | |
for j in range(img.size[1]): | |
r, b, g = pixels[i, j] |
import { pipe } from "fp-ts/lib/function"; | |
const add = | |
(first: number) => | |
(second: number): number => { | |
return first + second; | |
}; | |
const add1 = add(1); | |
const add3 = add(3); |
import * as E from "fp-ts/Either"; | |
import * as F from "fp-ts/function"; | |
const minxLength = (s: string): E.Either<Error, string> => { | |
return s.length < 8 ? E.left(new Error("Password is too short")) : E.right(s); | |
}; | |
const oneCapital = (s: string): E.Either<Error, string> => | |
/[A-Z]/g.test(s) | |
? E.right(s) |
import axios, { AxiosResponse } from "axios"; | |
import * as F from "fp-ts/function"; | |
import * as E from "fp-ts/Either"; | |
import * as T from "fp-ts/Task"; | |
import * as TE from "fp-ts/TaskEither"; | |
type ToDo = { | |
userId: number; | |
id: number; | |
title: string; |
import * as TE from "fp-ts/TaskEither"; | |
import { pipe } from "fp-ts/function"; | |
const createUser = (username: string): TE.TaskEither<Error, string> => { | |
return TE.right(`UserId-${username}`); | |
}; | |
const createOrder = (userId: string): TE.TaskEither<Error, string> => { | |
return TE.right(`Order-${userId}`); | |
}; |