This file contains hidden or 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
| [Unit] | |
| Description=mtproxy | |
| Wants=network-online.target | |
| After=network-online.target | |
| [Service] | |
| Type=simple | |
| ExecStart=/opt/mtg run -v -w 128KB -r 128KB --prefer-ip ipv6 --cloak-port 993 -b 0.0.0.0:443 ee5c557d37ddde51c21d4577a29b88bbcc6d747072782e6e6f772e696d | |
| AmbientCapabilities=CAP_NET_BIND_SERVICE | |
| Restart=never |
This file contains hidden or 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 ubuntu:20.04 | |
| # | |
| # 1. Hadoop | |
| # | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get -qq update && apt-get -qq -y install openjdk-14-jdk-headless wget build-essential krb5-user\ | |
| && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log |
This file contains hidden or 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
| $ cat /etc/systemd/system/example.service | |
| [Unit] | |
| Description=basic service | |
| [Service] | |
| Type=notify | |
| ExecStart=/bin/bash /usr/bin/true | |
| Restart=on-failure | |
| NoNewPrivileges=yes |
This file contains hidden or 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
| #https://unix.stackexchange.com/a/298409 | |
| sudo socat tcp-listen:500,fork,reuseaddr \ | |
| exec:'ip netns exec vpn socat STDIO "tcp-connect:127.0.0.1:5000"',nofork |
This file contains hidden or 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
| # koalas don't support iterrows. so we convert iterrows() to itertuples() format | |
| if internal_itertuples: | |
| Row = namedtuple('Row', df.columns) | |
| def convert_iterrow_to_itertuples(df): | |
| for row in df.iterrows(): | |
| yield Row(*row[1]) | |
| itertuples = convert_iterrow_to_itertuples(df) | |
| else: |
This file contains hidden or 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
| Linux network namespaces can be used to control which processes should be tunneled by OpenVPN. | |
| http://www.naju.se/articles/openvpn-netns.html | |
| Example | |
| First create an --up and --down script for OpenVPN. This script will create the VPN tunnel interface inside a network namespace called vpn, instead of the default namespace. | |
| cat > netns-script << 'EOF' | |
| #!/bin/sh | |
| case $script_type in | |
| up) |
This file contains hidden or 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
| # https://wiki.archlinux.org/title/Trusted_Platform_Module#Clevis | |
| sudo dnf install clevis\* | |
| # check the correct partition with lsbk | |
| sudo lsblk | |
| # bind clevis to secure boot | |
| sudo clevis luks bind -d /dev/nvme0n1p3 tpm2 '{"pcr_ids":"1,7"}' |
This file contains hidden or 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
| apk update | |
| # luci addons | |
| apk add luci-app-statistics | |
| # dns over tls | |
| # https://openwrt.org/docs/guide-user/services/dns/dot_dnsmasq_stubby | |
| # apk add dnsmasq stubby | |
| # generic routing encapsulation. requirement for vpn.ua.pt |
This file contains hidden or 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
| # CONDA | |
| # create env | |
| conda config --add channels conda-forge | |
| conda config --set channel_priority strict | |
| conda create --strict-channel-priority -n jupyter | |
| conda activate jupyter | |
| # jupyter, notebook and old notebook extensions | |
| conda install -y jupyterlab |
This file contains hidden or 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 logging | |
| filename = 'spam.log' | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.DEBUG) | |
| # create file handler which logs even debug messages | |
| fh = logging.FileHandler(filename) | |
| fh.setLevel(logging.DEBUG) |