Skip to content

Instantly share code, notes, and snippets.

a = ["apple", "pear", "orange"]
b = ["apple", "orange", "grape"]
"""
This program matches fruits between two lists, noting their indices or marking them as None if absent in either list.
Output will be:
[(0, 0, 'apple'), (1, None, 'pear'), (2, 1, 'orange'), (None, 2, 'grape')]
"""
enumerated_a = list(enumerate(a))

Как найти файлы конфигурации:

Выберите один из методов

Вариант I. С помошью утилиты find:

sudo find / -type f -name "pg_hba.conf" -not -path "/mnt/*" 2>/dev/null # хуита, он просто пропускает?
sudo find /etc/ -type f -name "pg_hba.conf" 2>/dev/null

Вариант II. Или с помошью утилиты locate:

Источник: https://stackoverflow.com/questions/3602450/where-does-postgresql-store-configuration-conf-files

# как зайти в БД postgres на wsl из pg_admin на windows хосте :
# 1. узнаём ip wsl:
$ ifconfig
inet 172.25.225.20
# или
PS> wsl hostname -I
172.25.225.20
## или
#$ ipconfig.exe # это не то
#include <iostream>
#include <vector>
using namespace std;
void print() {
cout << endl;
}
template <typename T>
# маленькие проги по типу синтаксис чек, или обсёрвер. Не мои:
* https://github.com/PCMan/python-find-unused-func
* https://github.com/dlidstrom/Duplo
* https://github.com/xsgordon/duplo-fork
* https://github.com/duploq/duploq
# мои:
@Lazzlo2096
Lazzlo2096 / Main.hs
Last active September 22, 2021 20:45
module Main where
import qualified Data.Map as M
-- :set -package containers
list1 = [1,2,3,4,5,6]
targetSum1 = 10
myFind :: (Ord a, Num a) => [a] -> a -> [a]
myFind list targetSum = myFind' Nothing list M.empty targetSum
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTSyntax #-}
--https://stackoverflow.com/questions/3643172/using-maybe-type-in-haskell
-- https://en.wikibooks.org/wiki/Haskell/Classes_and_types
-- https://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types
-- https://wiki.haskell.org/Data_declaration_with_constraint
@Lazzlo2096
Lazzlo2096 / one.hs
Created March 3, 2019 23:38
monadsss
main =
putStrLn "What's your name?" >>
getLine >>=
--(\s -> putStrLn $ "Hello " ++ s)
-- \x -> return ("Hello " ++ x) >>= putStrLn
return.("Hello " ++) >>= putStrLn
import CodeWorld
-- https://code.world/haskell
main = drawingOf rewq
rewq = polyline $ getNFractal myShape1
getNFractal ps = [ x | i <- [ (1.0, 0.0), (0.0, 1.0)], x <- getChild2 i ps]
getNFractal [] = []