Gerir pacotes
- Actualizar repositório
apt-get update
- Actualizar pacotes
apt-get upgrade
- Instalar pacote
apt-get install pacote
Gerir serviços
- Saber o estado:
systemctl status serviço
- Ver os logs do serviço:
journalctl -u serviço
from functools import reduce | |
def compose(fns): | |
def _compose(fn1, fn2): | |
return lambda x: fn2(fn1(x)) | |
if len(fns) == 0: | |
return lambda x: x | |
return reduce(_compose, fns) |
from typing import Iterable, Iterator, TypeVar, Generic, List, Optional | |
T = TypeVar('T') | |
class _CachedIterator(Generic[T]): | |
def __init__(self, cached_iterable: CachedIterable[T]) -> None: | |
self.cached_iterable = cached_iterable |
def numbers_for_bounds(*args): | |
assert args and len(args) % 2, 'Unbalanced or empty bounds' | |
bounds = list(args) | |
first_bounds, *range_bounds = sorted(zip(bounds[0::2], bounds[1::2])) | |
start, first_upper = first_bounds | |
yield from range(start, first_upper + 1) | |
for lower, upper in range_bounds: |
function delay(fns, interval) { | |
[fn, ...fnsTail] = fns | |
if (fn) { | |
setTimeout( | |
() => { fn(); delay(fnsTail, interval) }, | |
interval | |
) | |
} | |
} |
from inspect import isgeneratorfunction | |
class Deferer: | |
def __init__(self): | |
self.defers = [] | |
@classmethod | |
def build(cls, func): |
(defn armstrong? [n] | |
(let [n-chars (apply vector (str n))] | |
(= n | |
(int | |
(reduce + | |
(map | |
(comp | |
#(Math/pow % (count n-chars)) | |
#(Character/getNumericValue %)) |
USERNAME=user | |
PASSWORD=pass |
#!/bin/sh | |
find . -name "*.mp4" -print0 | while read -d $'\0' filepath | |
do | |
echo "$filepath" | |
filedate=$(echo "$filepath" | ggrep -P -o "(?<=clip-)(.*)(?=.mp4)") | |
formateddate=$(date -j -f "%F %H;%M;%S" "$filedate" "+%Y:%m:%d %H:%M:%S") | |
if [ -z "$formateddate" ] | |
then | |
>&2 echo "Invalid date. Skipping command" |
Gerir pacotes
apt-get update
apt-get upgrade
apt-get install pacote
Gerir serviços
systemctl status serviço
journalctl -u serviço
nginx
.nginx
./etc/nginx/sites-available/default
..html
. As páginas do site devem obedecer a isso./bem-vindos.html
. O conteúdo deve ser Bem-vindos ao meu site!
/eu.html
. O a dizer o teu nome Eu sou o João
.Boas-vindas
que leva para a página `bem