Skip to content

Instantly share code, notes, and snippets.

View nfedyashev's full-sized avatar

Nikita Fedyashev nfedyashev

View GitHub Profile
@nfedyashev
nfedyashev / youtube.py
Last active October 11, 2024 14:58
python3 youtube.py --url "$YOUTUBE_URL" --language en --output "transcription.txt"
import os
import sys
import yt_dlp
from pydub import AudioSegment
import openai
import math
from tqdm import tqdm
import argparse
import tempfile
import shutil
(defun gptel--strip-mode-suffix (mode-sym)
"Remove the -mode suffix from MODE-NAME.
MODE-NAME is typically a major-mode symbol."
- (let ((mode-name (thread-last
- (symbol-name mode-sym)
- (string-remove-suffix "-mode")
- (string-remove-suffix "-ts"))))
- (if (provided-mode-derived-p
- mode-sym 'prog-mode 'text-mode 'tex-mode)
@nfedyashev
nfedyashev / find_relevant_chunk.txt
Created April 21, 2024 11:26
agentic chunker prompts
Determine whether or not the "Proposition" should belong to any of the existing chunks.
A proposition should belong to a chunk of their meaning, direction, or intention are similar.
The goal is to group similar propositions and chunks.
If you think a proposition should be joined with a chunk, return the chunk id.
If you do not think an item should be joined with an existing chunk, just return "No chunks"
Example:
Input:
@nfedyashev
nfedyashev / expech.sh
Created March 9, 2023 19:37
Using expect to drive netcat - Simply piping the required sequence of commands into netcat is unlikely to work because the SMTP commands and responses would not be properly interleaved. If you want to use the method above from a script then you will need to make use of a program such as expect. Here is an example:
#!/usr/bin/expect
set timeout 30
proc abort {} { exit 2 }
spawn nc -C mail.example.org 25
expect default abort "220 "
send "HELO example.com\r"
expect default abort "\n250 "
send "MAIL FROM:[email protected]\r"
@nfedyashev
nfedyashev / config
Created July 22, 2021 13:12
i3blocks - ruby json output command
# [ib]
# command=/home/nikita/.rbenv/shims/ruby /home/nikita/Projects/nikita-dotfiles/bin/ibb
# interval=10
# format=json
# frozen_string_literal: true
require "bundler/setup"
require_relative "../lib/ibb
require 'json'
@nfedyashev
nfedyashev / config
Created July 22, 2021 13:09
i3blocks - clickable command counter
[click-loop-json]
full_text=Click me!
command=ruby -r json -n -e '$_ = JSON.parse($_)' -e '$_["full_text"] = "Click %s at (%d,%d)" % $_.slice("button", "x", "y").values' -e 'puts JSON.dump($_)' -e 'STDOUT.flush'
interval=persist
format=json
@nfedyashev
nfedyashev / presentation.org
Created February 15, 2021 22:29 — forked from abrochard/presentation.org
Notes from the "Conquering Kubernetes with Emacs" presentation

Conquering Kubernetes with Emacs

Specific Annoying workflow

Listing pods with kubectl get pods, then select a pod name and copy paste it into kubectl logs [pod name]

Why?

  • I want to streamline my workflow and stop using the terminal
  • learn more about kubernetes
  • main kubernetes extension for Emacs out there is greedy for permissions
// custom error handling logic
const retryThreeTimes = obs =>
obs.retry(3).catch(_ => Rx.Observable.of('ERROR!'));
const examplePromise = val =>
new Promise(resolve => resolve(`Complete: ${val}`));
//faking request
const subscribe = Rx.Observable.of('some_url')
.mergeMap(url => examplePromise(url))
// could reuse error handling logic in multiple places with let
The simplest implementation might look like this:
<!-- language: lang-ruby -->
class ArrayUtils
def self.multiplos(num, step)
step.step(num * step, step).to_a
end
end

The simplest implementation might look like this:

class ArrayUtils def self.multiplos(num, step) step.step(num * step, step).to_a end end