Skip to content

Instantly share code, notes, and snippets.

@rkhapov
rkhapov / gist:d0eb5651b44a8056d5860b2a3c435ce3
Created March 29, 2021 10:17
my best of the best .vimrc
syntax on
set number
set tabstop=4
set autoindent
set softtabstop=4
set list
set listchars=eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<,space:·
set clipboard=unnamedplus
@rkhapov
rkhapov / pop3.py
Created May 3, 2019 10:44
pop3 client
import socket
import base64
import select
import ssl
import json
import argparse
import os
import shutil
from email.parser import Parser
@rkhapov
rkhapov / port_scan.py
Created April 24, 2019 17:06
port scanner
import socket
import select
import argparse
import multiprocessing as mp
import errno
import os
import threading
import struct
import threading
import time
@rkhapov
rkhapov / tracrt.py
Created March 28, 2019 11:49
tracert
import json
import argparse
import requests
import subprocess
import re
IP_REGEXP = re.compile('(?:[0-9]{1,3}\\.){3}[0-9]{1,3}')
RESOLVER = 'https://ipinfo.io/{}/json'
def parse_args():
@rkhapov
rkhapov / cmder_promt.sh
Last active June 7, 2019 04:42
This is script for make bash prompt be similar to windows cmder style. Shows current git branch in dir in white if there is nothing to commit and working tree are clean. Better use with Twilight Dark color scheme
# Pretty prompt in bash, cmder style
# better use with Twilight Dark terminal color scheme
GREEN=`tput setaf 2`
RED=`tput setaf 196`
GRAY=`tput setaf 239`
RESET=`tput sgr0`
BOLD=`tput bold`
WHITE=`tput setaf 15`
LAMBDA_8=`printf '\xce\xbb'`
@rkhapov
rkhapov / solved_2018_20.py
Created July 5, 2018 05:43
solved task for sum of 3 sequent digit are not greater than 9
answer_20 = 378158756814587
def is_num_right(num):
if num < 100:
return sum(map(int, str(num))) <= 9
for i in range(len(str(num)) - 2):
if sum(map(int, str(num)[i:i+3])) > 9:
return False
return True
#!/usr/bin/env python3
from enum import Enum
from html.parser import HTMLParser
class Sex(Enum):
MALE = 1
FEMALE = 2
def __hash__(self):
using System;
using System.Collections.Generic;
namespace BaconsChipher
{
class EntryPoint
{
//public static int Module = 1000000009;
//public static int Module = 1073676287;
//public static int Module = 2147483647;
@rkhapov
rkhapov / cvs.cs
Created February 11, 2018 06:49
cvs
using System;
using System.Linq;
using System.Collections.Generic;
namespace Clones
{
public class FastStackNode<T>
{
public FastStackNode<T> Prev;
public T Value;
@rkhapov
rkhapov / addtext.sh
Created December 19, 2017 15:45
add text task
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then
echo "This is script for adding text at the rigth corner"
echo "Usage: ./addtext.sh <input_directory> <text> <output_directory>"
exit 0
fi
if ! [ "$1" ] || ! [ "$2" ] || ! [ "$3" ]; then
echo "Error: expected parameters (see -h or --help for more)"