Skip to content

Instantly share code, notes, and snippets.

@xr09
xr09 / docker-fedora-33-dns.md
Created February 15, 2024 14:54 — forked from RedRoserade/docker-fedora-33-dns.md
Working around Docker DNS issues on Fedora 33. Adapted from https://stackoverflow.com/a/60113249

Problem

Docker on Fedora 33 has issues with systemd-resolved. This causes DNS issues when, for example, connecting VPNs, because it'll use the wrong DNS server, especially if you have several configured. The one from systemd-resolved is ignored since it's a 127.0.0.X address.

This causes containers to not be able to resolve addresses on the private network (VPN).

Solution

Use dnsmasq to listen on docker0 and forward DNS requests to systemd-resolved running on 127.0.0.53.

@xr09
xr09 / create_user.py
Created October 27, 2020 11:52
Python script to Create API User
import logging
import sys
import json
import random
import string
import argparse
import os
# Set framework path
sys.path.append("/var/ossec/framework")
[
{
"target": "buster",
"vulnerabilities": [
{
"package": {
"name": "firefox",
"version": "68",
"format": "rpm"
},
@xr09
xr09 / knocker.py
Last active November 12, 2018 15:41
import csv
import datetime
import subprocess
import logging
from concurrent.futures import ThreadPoolExecutor
WORKERS_FILE = 'workers.csv'
@xr09
xr09 / request_cache.py
Created November 27, 2017 00:06
using shelve as cache for request
import logging
import shelve
import requests
_HEADERS = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/53.0.2785.143 Safari/537.36'}
_TIMEOUT = 5
@xr09
xr09 / README.md
Created January 9, 2017 14:54
download alpine repo

generate urls

python3 alpine.py > urls

feed urls to aria2c

aria2c -d main/x86_64/ -i urls

@xr09
xr09 / bobp-python.md
Created December 29, 2016 22:03 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@xr09
xr09 / contextmanager.md
Created December 29, 2016 22:01 — forked from bgilbert/contextmanager.md
Python context managers

Context managers

In Python, a context manager is an object that can be used in a with statement. Here's a context manager that reports the total wall-clock time spent inside a with block:

import time

class Timer(object):
    def __init__(self, msg):
        self._msg = msg
@xr09
xr09 / example.py
Last active December 27, 2016 20:04
from sandpiper import Domain
# credenciales del dominio windows
windows_config = {
'uri': "192.168.1.10",
'dn': "OU=dominio,DC=hlg,DC=emp,DC=cu",
'user': 'winuser',
'password': 'qwerty',
}
@xr09
xr09 / gist:a722368207ca41afc1b17b77076db9da
Created November 21, 2016 17:05
command line for compiling kernel on debian
nice -n19 ionice -c2 -n7 fakeroot make -j5 bindeb-pkg