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
# 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 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 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 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 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 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) |
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
vbell off | |
term screen-256color | |
hardstatus off | |
hardstatus alwayslastline | |
hardstatus alwayslastline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]' | |
defnonblock on | |
scrollback 15000 | |
setenv LD_PRELOAD /usr/lib/libjemalloc.so |
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
import logging | |
# level=logging._nameToLevel[verbosity_level] | |
# level=logging.DEBUG | |
# format="%(asctime)s [%(module)-12.12s] [%(levelname)-5.5s] %(message)s", | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format="%(asctime)s [%(levelname)-5.5s] %(message)s", |
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
# tests the avalability of cuda for pytorch | |
import torch | |
torch.cuda.current_device() | |
torch.cuda.device(0) | |
torch.cuda.device_count() | |
torch.cuda.get_device_name(0) | |
torch.cuda.is_available() |
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
# trick to make iJulia work on CentOS 7 | |
# CentOS looks like to have some kind of ABI incompatibility | |
# ERROR: LoadError: InitError: could not load library "/home/centos/.julia/artifacts/8b67c92bc6eb60d96d3488bf4b48bd3a38f70c53/lib/libzmq.so" | |
# /usr/bin/../lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/centos/.julia/artifacts/8b67c92bc6eb60d96d3488bf4b48bd3a38f70c53/lib/libzmq.so) | |
] | |
add [email protected] | |
add iJulia | |
using iJulia |