Skip to content

Instantly share code, notes, and snippets.

View imneonizer's full-sized avatar
:octocat:
Developing for the python community!

Nitin Rai imneonizer

:octocat:
Developing for the python community!
  • SmartCow.ai
  • Delhi, India
  • 07:07 (UTC +05:30)
  • X @imneonizer
View GitHub Profile
# https://gist.github.com/Lazza/bbc15561b65c16db8ca8
import os
import requests
import base64
import time
import subprocess as sp
class VpnGate:
def __init__(self, country, config='/tmp/vpngate.ovpn'):
#!/bin/bash
# https://itsfoss.com/speed-up-slow-wifi-connection-ubuntu/
# increase wifi adapter power
# sudo iwconfig
sudo iwconfig wlo1 power off
@imneonizer
imneonizer / portsi.py
Last active October 12, 2021 07:38
Portsi is used to scan network for open ports
import socket
from contextlib import closing
from concurrent.futures import ThreadPoolExecutor
from itertools import product
class Portsi:
def __init__(self, timeout: float = 2.0, workers: int = 1000):
"""Portsi is used to scan network for open ports
Args:
@imneonizer
imneonizer / droid_cam.sh
Created August 30, 2021 07:35
Automatically discover droidcam client
#!/bin/bash
export ANDROID_SERIAL=`adb devices -l | grep -i oneplus | awk '{print $1}'`
droidcam-cli adb 4747&
scrcpy
@imneonizer
imneonizer / client.py
Created September 13, 2021 08:26
HiveMQTT Custom Req-Resp with Auth
# pip install paho-mqtt
import paho.mqtt.client as paho
import paho.mqtt.subscribe as subscribe
import uuid
import contextlib
import threading
import json
import time
class MQTTClient:
@imneonizer
imneonizer / capture.sh
Created August 30, 2021 04:11
capture rtsp snapshot using gstreamer
# https://stackoverflow.com/questions/59025321/capture-jpeg-images-from-rtsp-gstreamer
gst-launch-1.0 rtspsrc location="rtsp://admin:123456@192.168.0.123/stream0" num-buffers=1 \
! rtph264depay ! avdec_h264 \
! nvjpegenc ! multifilesink location="./frame.jpg"
@imneonizer
imneonizer / generate_colors.py
Created July 7, 2021 06:43
Generate consistent random colors
import random
import colorsys
def generate_colors(n):
random.seed(10101)
hsv_tuples = [(x / n, 1., 1.) for x in range(n)]
colors = list(map(lambda x: colorsys.hsv_to_rgb(*x), hsv_tuples))
colors = list(map(lambda x: (int(x[0] * 255), int(x[1] * 255), int(x[2] * 255)), colors))
random.shuffle(colors)
random.seed(None)

1. Stop the docker daemon

sudo service docker stop

2. Add a configuration file to tell the docker daemon what is the location of the data directory Using your preferred text editor add a file named daemon.json under the directory /etc/docker.

sudo vim /etc/docker/daemon.json
# https://github.com/yogin16/prototxt_parser
# pip install parsy==1.3.0
from parsy import generate, regex, string
# Convert an array of tuples array [[(a,b),(a,c)]] to an object {a: [b,c]}
def tuples_to_dict(a):
# print(a)
new_dict = {}
for tuples in a: