- Instala o servidor http
nginx
. - Inicia o serviço
nginx
. - Acede ao teu ip através do browser.
- Consulta o ficheiro de configuração do servidor nginx em
/etc/nginx/sites-available/default
. - À direta da palavra "root", está o nome da pasta que está a ser servida pelo servidor. Entra nessa pasta e consulta o seu conteúdo.
- Modifica o conteúdo do ficheiro, e actualiza a página do teu ip no browser. Podes apagar o conteúdo original. Adiciona uma mensagem a dizer "Olá amigos!". Note que este ficheiro acaba em
.html
. As páginas do site devem obedecer a isso. - Cria outros ficheiros dentro desta pasta. Tenta aceder a esses ficheiros através do browser, usa o URL do browser.
- Cria uma página no teu site com o url
/bem-vindos.html
. O conteúdo deve serBem-vindos ao meu site!
- Cria uma página no teu site com url
/eu.html
. O a dizer o teu nomeEu sou o João
. - O teu site deverá ser navigável. Na página principal deve haver dois links, um a dizer
Boas-vindas
que leva para a página `bem
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
Usando o sistema operativo Linux, distribuição Ubuntu.
- Actualiza os repositórios dos pacotes.
- Instalar os pacotes:
xfce4
exfce4-goodies
. Escolher “gdm” durante a instalação. - O ambiente gráfico já está instalado. Agora temos de nos ligar ao ao nosso computador através do protocolo VNC. No servidor instalamos o pacote
tightvncserver
. - Para iniciar o servidor VNC, usar o comando
vncserver
. Sempre que se muda as configurações, é necessário o reiniciar. Para parar o servidor:vncserver -kill :1
- O script de configuração do VNC está localizado em
/root/.vnc/xstartup
deverá ser configurado para iniciar o ambiente gráfico xfce4 que instalámos anteriormente. Deverá ter o seguinte conteúdo:
#!/bin/bash
xrdb $HOME/.Xresources
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
{ | |
"log":{ | |
"access":"/var/log/v2ray/access.log", | |
"error":"/var/log/v2ray/error.log", | |
"loglevel":"warning" | |
}, | |
"inbounds":[ | |
{ | |
"port":80, | |
"protocol":"vmess", |
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
#!/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" |
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
USERNAME=user | |
PASSWORD=pass |
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
from inspect import isgeneratorfunction | |
class Deferer: | |
def __init__(self): | |
self.defers = [] | |
@classmethod | |
def build(cls, func): |
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
function delay(fns, interval) { | |
[fn, ...fnsTail] = fns | |
if (fn) { | |
setTimeout( | |
() => { fn(); delay(fnsTail, interval) }, | |
interval | |
) | |
} | |
} |
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
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: |
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
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 |