Skip to content

Instantly share code, notes, and snippets.

@baydakovss
baydakovss / openai_translate.py
Last active May 26, 2023 12:02
Translate big text to target language in chat mode OpenAI with keeping context to better translation
import openai
import nltk
nltk.download('punkt')
openai.api_key = "XXXXXXXX"
def split_sentences(text, max_length):
"""
splitting text into chunks by sentences, not exceeding a specified maximum .
@baydakovss
baydakovss / Vagrant_setup,md
Created May 25, 2023 06:37
Vagrant +Windows + WSL2 + Hyper-v
# Vagrant With Windows, WSL2 and Hyper-V
To say getting this configuration working is a pain in the ass is an understatement. However, once it is working correctly you gain access to tools like Ansible and full performance VMs inside Windows. This guide covers the steps I followed to get things working correctly with this configuration. It is possible that something may not work for you however I have been able to reproduce this success on two Windows 11 Pro machines and expect this to work for others.
This guide assumes basic knowledge of Windows and Linux systems and how Vagrant operates. Due to the difficulty of setting this up you may need to do some additional troubleshooting
## Requirements
* Windows Professional - Hyper-V can only be installed on Windows Professional systems or higher
* WSL2 - Due to the massive differences between WSL1 and WSL2 this guide will only cover support for WSL2
* CPU Virtualization - While the vast majority of modern CPUs support virtualization you may need to enable it in
Tereminal 1:
socat TCP-L:12345,fork,reuseaddr EXEC:'sqlite3 /home/user/sources/test.db',pty
Terminal 2:
telnet localhost 12345
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
DOCKER_BUILDKIT=0 docker build .
...
docker run -it --rm 638adc3fd0fa sh
@baydakovss
baydakovss / gist:89d8b5d6bf2b357b220b753a7c1dcf51
Last active November 21, 2022 15:08
Error: `Fields "address" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
query ($network: EthereumNetwork!,
$s_addresses: [String!],
$e_addresses: [String!]
)
{
ethereum(network: $network) {
address1: address(address: {in: $s_addresses}) {
balances(currency: {is: "0x55d398326f99059ff775485246999027b3197955"}) {
currency {
name
@baydakovss
baydakovss / iptables_geoip_debian.md
Created April 6, 2022 15:21 — forked from netrunn3r/iptables_geoip_debian.md
Install geoip for iptables in Debian 10
  1. change from buster to bullseye
  2. sudo apt install libnet-cidr-lite-perl libtext-csv-xs-perl libgeoip2-perl

for day of writing, there is a problem with building by dkms this package xtables-addons-common so wehave to install this from source

  1. sudo apt install pkg-config libxtables-dev
  2. wget http://inai.de/files/xtables-addons/xtables-addons-3.13.tar.xz
  3. tar xf xtables-addons-3.13.tar.xz
  4. cd xtables-addons-3.13/
  5. ./configure
  6. make
@baydakovss
baydakovss / NewlyCreatedTokenQuery.ql
Created December 10, 2021 06:32 — forked from buddies2705/NewlyCreatedTokenQuery.ql
GraphQL API to get the newly created Ethereum Tokens
{
ethereum {
smartContractCalls(options: {desc: "block.height", limit: 10}, smartContractMethod: {is: "Contract Creation"}, smartContractType: {is: Token}) {
block {
height
timestamp {
time
}
}
smartContract {

How to setup gitlab without embedded nginx

Install via omnibus-package

install the normal way:

wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64.deb & > /dev/null

sudo apt-get update
sudo apt-get upgrade
# Source: https://gist.github.com/820aecf0799d679d9082eef00d07b515
#############################################################################
# Bitnami Sealed Secrets #
# How To Store Kubernetes Secrets In Git Repositories Without Getting Fired #
# https://youtu.be/xd2QoV6GJlc #
#############################################################################
# Referenced videos:
# - What Is GitOps And Why Do We Want It?: https://youtu.be/qwyRJlmG5ew