Skip to content

Instantly share code, notes, and snippets.

View nikiforidi's full-sized avatar
🚀
speak less, do more

Anatoli Nikiforidi nikiforidi

🚀
speak less, do more
View GitHub Profile
@c0rs3c
c0rs3c / Avoid getting disconnected to VPS after starting a VPN server on it.txt
Last active July 11, 2022 19:16
Avoid getting disconnected to VPS after starting a VPN server on it
Once after connecting VPN, ssh getting disconnected because, ssh traffic from the server going via VPN server. So to avoid this run the following command before connecting VPN.
1. Solution 1 (BUt its IP address dependent from which the ssh connection is being made to VPS - Try this at end. Go for Solution 2):
route add -host your-machine-public-ip gw Server-gatway-ip dev eth0
your-machine-public-ip : IP of your machine from where you are doing SSH. Server-gatway-ip: Gatway/router's IP of that server
The above command will redirect the traffic via the given gateway not through VPN Server.
@darwing1210
darwing1210 / async_download_files.py
Last active August 30, 2025 07:33
Script to download files in a async way, using Python asyncio
import os
import asyncio
import aiohttp # pip install aiohttp
import aiofile # pip install aiofile
REPORTS_FOLDER = "reports"
FILES_PATH = os.path.join(REPORTS_FOLDER, "files")
def download_files_from_report(urls):
@yougg
yougg / proxy.md
Last active January 18, 2026 10:28
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@wikiti
wikiti / bash.sh
Last active November 5, 2023 22:32
Backup and restore in PostgreSQL using compressed backups.
# List databases
sudo su postgres
psql
\list
# Create a compressed backup
sudo su postgres
pg_dump -Fc <database_name> > <file>
# Example
@rroohhh
rroohhh / install.sh
Last active December 22, 2025 12:20
building go with mips softfloat support
# clone git
git clone https://github.com/golang/go
cd go
# checkout the correct commit for the patch
git checkout bad5abf64d76f9c302c084c5f62e6f70920d3c81
# apply the patch
git apply mips_softfloat.patch
# build go
cd src
./all.bash
@amarao
amarao / blame-praise.py
Last active September 28, 2025 15:59
Example of argparse with subparsers for python
#!/usr/bin/env python
import argparse
def main(command_line=None):
parser = argparse.ArgumentParser('Blame Praise app')
parser.add_argument(
'--debug',
action='store_true',
help='Print debug info'
@4ft35t
4ft35t / udp2tcp_dns.py
Created February 22, 2017 06:05 — forked from korc/udp2tcp_dns.py
Convert DNS UDP to TCP
#!/usr/bin/python
import socket, os, select, struct
import errno
import logging
from logging import info, warn, error
logging.root.setLevel(logging.INFO)
@andreagrandi
andreagrandi / permissions.py
Created September 30, 2016 09:49
IsAdminOrReadOnly is a custom Django Rest Framework permission class that allows Admin users to POST and anonymous to GET
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsAdminOrReadOnly(BasePermission):
def has_permission(self, request, view):
if request.method in SAFE_METHODS:
return True
else:
return request.user.is_staff
@nitoyon
nitoyon / rgb.go
Created January 1, 2016 16:08
Generate Animation GIF with Golang
package main
import (
"fmt"
"image"
"image/color"
"image/gif"
"math"
"os"
)
@perrygeo
perrygeo / base64_padding.md
Last active December 9, 2025 17:50
Avoiding TypeError: Incorrect padding with Python's base64 encoding

Avoiding padding errors with Python's base64 encoding

>>> import base64
>>> data = '{"u": "test"}'
>>> code = base64.b64encode(data)
>>> code
'eyJ1IjogInRlc3QifQ=='