Skip to content

Instantly share code, notes, and snippets.

View palawer's full-sized avatar

palawer palawer

View GitHub Profile
@palawer
palawer / disable_ipv6.md
Created January 31, 2025 15:28
Disable IPv6 System-Wide

Disable IPv6 System-Wide

Temporarily disable IPv6:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

To disable IPv6 permanently, add these lines to /etc/sysctl.conf:

@palawer
palawer / plot.py
Last active March 6, 2025 10:39
Plot values
import matplotlib.pyplot as plt
# Updated data points
y_values = [298643, 299892, 307425, 333984, 349718, 376046, 387230, 386379, 389032, 363783, 338725, 339847, 325985, 321344, 359120, 373366, 377477, 388196, 391048, 392841]
x_values = list(range(len(y_values)))
# Plot in line
plt.figure(figsize=(12, 6))
plt.plot(x_values, y_values, marker='o', linestyle='-', color='g', label="Values")
plt.title("Line Plot of Updated Values", fontsize=14)
#!/usr/bin/env python3
from concurrent.futures import ThreadPoolExecutor, as_completed
from itertools import zip_longest
def grouper(iterable, n=1000, fillvalue=None):
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue)
def async_func(number):
return number * number
@palawer
palawer / nmap.sh
Last active May 26, 2024 09:02
nmap
# scan ports
nmap -p- --open -sT --min-rate 5000 -vvv -n -Pn <ip> -oG allPorts
# find services
nmap -sCV -p80,139,445 <ip> -oN targeted
nmap -sCV -p <ip> -oN targeted
ssh -D 5000 <server>
export http_proxy="socks5://127.0.0.1:5000"
export https_proxy="socks5://127.0.0.1:5000"
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
container_name: elasticsearch-logs
restart: always
network_mode: host
environment:
- xpack.security.enabled=false
- discovery.type=single-node
@palawer
palawer / celery_tasks.py
Created September 25, 2023 10:51
Celery custom backend fields
celery_app = Celery(
'celery_tasks',
broker=BROKER_URL,
backend='celery_tasks:CustomBackendResult',
elasticsearch_save_meta_as_text=False,
result_extended=True,
)
class CustomBackendResult(ElasticsearchBackend):
def __init__(self, url=None, *args, **kwargs):
@palawer
palawer / log.py
Created August 16, 2023 07:06
Logger with custom log file form parameter
import argparse
import logging
import os
logging.basicConfig(
format='%(asctime)s %(levelname)s %(message)s',
level=logging.INFO,
handlers=[logging.StreamHandler()]
)
@palawer
palawer / conda_env.sh
Created August 9, 2023 04:20
Conda env
conda create -n py3.11 python=3.11
conda activate py3.11
@palawer
palawer / adb.sh
Last active December 10, 2024 05:49
Get apk from android device
# More alternatives:
# https://github.com/mitmproxy/android-unpinner
# https://github.com/httptoolkit/frida-interception-and-unpinning
# Get apks:
# https://github.com/EFForg/apkeep
# pull apk from device
adb shell pm list packages
adb shell pm path com.example.someapp
adb pull /data/app/com.example.someapp.apk path/to/desired/destination