Skip to content

Instantly share code, notes, and snippets.

View Sagleft's full-sized avatar

Sagleft Sagleft

View GitHub Profile

Рассмотрим пошагово как установить клиент Utopia и настроить бота diano-bot для переноса контента из Telegram в Utopia канал.

Если вам нужен готовый образ виртуальной машины то можете найти его здесь (тут будет ссылка). Если захотите обновить клиент на виртуальной машине, то запустите скрипт ~/utopiahome/update_utopia.sh

Рассмотрим на примере системы с CentOS 7 и пользователем "utopiauser". Важно! Не работайте под рутом и не закидывайте бота в /root/... иначе что-то может не работать из-за прав доступа или потому что сломается относительный путь домашней папки.

Создаем папку, в которой будем работать.

cd ~
@Sagleft
Sagleft / minimize_error_checking.md
Created July 13, 2022 15:52
сворачивание проверки ошибок на Golang

Например, надоедает писать конструкции вида

err := myfunc()
if err != nil {
    panic(err)
}
err = myfunc2()
if err != nil {
 panic(err)
yum update -y
yum install -y libxkbcommon-x11.x86_64 libGL pulseaudio-libs-glib2 libXi libSM libXrender fontconfig libxcb xcb-util-image xcb-util-renderutil gstreamer1-plugins-base-devel mesa-dri-drivers mesa-libGL mesa-libGLU libXcomposite libwayland-cursor libwayland-egl xcb-util-wm xcb-util-keysyms unzip nano git wget
cd /home
cat << EOF >> update_utopia.sh
wget https://update.u.is/downloads/linux/utopia-latest.x86_64.rpm
rpm -ivh --replacepkgs utopia-latest.x86_64.rpm
EOF
sh update_utopia.sh
#!/bin/bash
# NOTE: copy utopia.cfg to script local folder from https://github.com/Sagleft/utopia-api-docker
# NOTE: this script will eventually create an account.db file and place it in the current working directory
# NOTE: you can use, for example, /home/ as a working directory
# NOTE: to run utopia you can use: /opt/utopia/messenger/utopia --headless --configPath=./utopia.cfg
apt-get update
apt-get install wget -y
wget https://update.u.is/downloads/linux/utopia-latest.amd64.deb
apt-get install gdebi-core libx11-xcb1 libgl1-mesa-glx libpulse-mainloop-glib0 libgtk-3-dev -y
\usepackage{animate}

\begin{frame}{Torque Generating Mechanism}
  \animategraphics[loop,controls,width=\linewidth]{12}{output/tmp-}{0}{34}
\end{frame}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract TokenLocker {
address public owner;
struct Lock {
address tokenAddress;