Skip to content

Instantly share code, notes, and snippets.

View hightemp's full-sized avatar
🎯
Focusing

Anton Panov hightemp

🎯
Focusing
View GitHub Profile
@hightemp
hightemp / wget-mirror-website.sh
Created February 23, 2024 10:55 — forked from svagionitis/wget-mirror-website.sh
A script to mirror a website using wget
#!/bin/sh -eu
# A script to mirror a website using wget
usage() {
cat << EOF
Usage: $(basename "$0") [-w website] [-u user_agent] [-b]
Where:
-w The website to mirror. The website will be like "https://example.com/"
-u The User agent to use. If no User agent is specified,
a Firefox default one is used.
@hightemp
hightemp / readme.md
Created February 9, 2024 08:55 — forked from sergey-glushakov/readme.md
Nvim плагины позволяющие форматировать код PHP

Nvim плагины позволяющие форматировать код PHP

В Nvim существует несколько плагинов, которые могут помочь вам форматировать код PHP. Вот некоторые из них:

  1. php-cs-fixer: Этот плагин был описан в предыдущем ответе и позволяет автоматически форматировать код согласно стандартам PHP.

    Для настройки php-cs-fixer в nvim, добавьте следующую строку в файл конфигурации:

    lua
    

require('php-cs-fixer').setup()

@hightemp
hightemp / article.md
Last active January 27, 2024 07:05
HTTP(S) Proxy in Golang in less than 100 lines of code

The goal is to implement a proxy server for HTTP and HTTPS. Handling of HTTP is a matter of parsing request, passing such request to destination server, reading response and passing it back to the client. All we need for that is built-in HTTP server and client (net/http). HTTPS is different as it’ll use technique called HTTP CONNECT tunneling. First client sends request using HTTP CONNECT method to set up the tunnel between the client and destination server. When such tunnel consisting of two TCP connections is ready, client starts regular TLS handshake with destination server to establish secure connection and later send requests and receive responses. Certificates

Our proxy will be an HTTPS server (when —-proto https will be used) so we need certificate and private key. For the purpose of this post let’s use self-signed certificate. To generate one use such script:

#!/usr/bin/env bashcase `uname -s` in
 
@hightemp
hightemp / GolangSSHTunnelForwardAndReverse.go
Created January 13, 2024 11:50 — forked from 0187773933/GolangSSHTunnelForwardAndReverse.go
Golang SSH Forward and Reverse Tunnel
package main
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"sync"
"syscall"
@hightemp
hightemp / HttpProxy.go
Created January 13, 2024 11:50 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@hightemp
hightemp / make_favicon.sh
Created January 5, 2024 12:08 — forked from nateware/make_favicon.sh
Imagemagick to create favicon.ico with 16x16 and 32x32 sizes in it
# IE is still braindead so still use favicon.ico
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico
convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico
convert output-16x16.ico output-32x32.ico favicon.ico
# Then, HTML needs to specify size="XxY" as largest size due to browser bugs
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
@hightemp
hightemp / tradingenv.py
Created December 29, 2023 08:25 — forked from mlblogger/tradingenv.py
Simple trading environment using openai gym
import gym
from gym.envs.registration import register
from gym import error, spaces, utils
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pandas_datareader.data as web
import arrow
import random
import sys
@hightemp
hightemp / github_openai_llamaindex.py
Created December 22, 2023 08:21
How To Chat With A Github Repository Using Llama-index
# Import the Github Repository Reader class
import os
from tokens import githubToken, apikey
import openai
from llama_index.readers import GithubRepositoryReader
from llama_index import VectorStoreIndex
from llama_index import StorageContext, load_index_from_storage
openai.api_key = apikey
@hightemp
hightemp / instruction
Created October 28, 2023 11:51 — forked from afiodorov/instruction
Run your own LLM & create an api endpoint for predictions
Docker Image : pytorch/pytorch
Image Runtype : jupyter_direc ssh_direc ssh_proxy
Environment : [["JUPYTER_DIR", "/"], ["-p 41654:41654", "1"]]
pip install torch bitsandbytes sentencepiece "protobuf<=3.20.2" git+https://github.com/huggingface/transformers flask python-dotenv Flask-HTTPAuth accelerate
!mv /opt/conda/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda116.so /opt/conda/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so