id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
151,361 | from jax import numpy as jnp
from jax.numpy import linalg
The provided code snippet includes necessary dependencies for implementing the `from_axis_angle` function. Write a Python function `def from_axis_angle(axis, theta)` to solve the following problem:
Constructs a quaternion for the given axis/angle rotation.
Her... | Constructs a quaternion for the given axis/angle rotation. |
151,362 | import copy
import json
from typing import Tuple, Union, Optional
import numpy as np
from hypernerf import gpath
from hypernerf import types
def _compute_residual_and_jacobian(
x: np.ndarray,
y: np.ndarray,
xd: np.ndarray,
yd: np.ndarray,
k1: float = 0.0,
k2: float = 0.0,
k3: float = 0.0,
... | Computes undistorted (x, y) from (xd, yd). |
151,363 | import abc
import collections
import copy
import math
from typing import Any, Iterable, List, Tuple, Union
from jax import numpy as jnp
def from_tuple(x):
schedule_type, *args = x
return SCHEDULE_MAP[schedule_type](*args)
def from_dict(d):
d = copy.copy(dict(d))
schedule_type = d.pop('type')
return SCHEDULE_M... | Creates a schedule from a configuration. |
151,364 | import functools
from typing import Any, Callable, Dict, Optional, Tuple, Sequence, Mapping
from flax import linen as nn
import gin
import immutabledict
import jax
from jax import random
import jax.numpy as jnp
from hypernerf import model_utils
from hypernerf import modules
from hypernerf import types
from hypernerf im... | Filters the density based on various rendering arguments. - `dust_threshold` suppresses any sigma values below a threshold. - `bounding_box` suppresses any sigma values outside of a 3D bounding box. Args: points: the input points for each sample. sigma: the array of sigma values. render_opts: a dictionary containing an... |
151,365 | import functools
from typing import Any, Callable, Dict, Optional, Tuple, Sequence, Mapping
from flax import linen as nn
import gin
import immutabledict
import jax
from jax import random
import jax.numpy as jnp
from hypernerf import model_utils
from hypernerf import modules
from hypernerf import types
from hypernerf im... | Neural Randiance Field. Args: key: jnp.ndarray. Random number generator. batch_size: the evaluation batch size used for shape inference. embeddings_dict: a dictionary containing the embeddings for each metadata type. near: the near plane of the scene. far: the far plane of the scene. Returns: model: nn.Model. Nerf mode... |
151,366 | import math
import time
from absl import logging
from flax import jax_utils
import jax
from jax import tree_util
import jax.numpy as jnp
import numpy as np
from hypernerf import utils
The provided code snippet includes necessary dependencies for implementing the `render_image` function. Write a Python function `def re... | Render all the pixels of an image (in test mode). Args: state: model_utils.TrainState. rays_dict: dict, test example. model_fn: function, jit-ed render function. device_count: The number of devices to shard batches over. rng: The random number generator. chunk: int, the size of chunks to render sequentially. default_re... |
151,367 | import functools
from typing import Any, Optional, Tuple
from flax import linen as nn
import gin
import jax
import jax.numpy as jnp
from hypernerf import model_utils
from hypernerf import types
The provided code snippet includes necessary dependencies for implementing the `get_norm_layer` function. Write a Python func... | Translates a norm type to a norm constructor. |
151,368 | from jax import numpy as jnp
from hypernerf import quaternion
The provided code snippet includes necessary dependencies for implementing the `add` function. Write a Python function `def add(dq1, dq2)` to solve the following problem:
Adds two dual quaternions.
Here is the function:
def add(dq1, dq2):
"""Adds two du... | Adds two dual quaternions. |
151,369 | from jax import numpy as jnp
from hypernerf import quaternion
def split_parts(dq):
"""Splits the dual quaternion into its real and dual parts."""
return real_part(dq), dual_part(dq)
def join_parts(real, dual):
"""Creates a dual quaternion from its real and dual parts."""
return jnp.concatenate((real, dual), axi... | Returns the quaternion conjugate. |
151,370 | from jax import numpy as jnp
from hypernerf import quaternion
def split_parts(dq):
"""Splits the dual quaternion into its real and dual parts."""
return real_part(dq), dual_part(dq)
def join_parts(real, dual):
"""Creates a dual quaternion from its real and dual parts."""
return jnp.concatenate((real, dual), axi... | Returns the dual number conjugate. |
151,371 | from jax import numpy as jnp
from hypernerf import quaternion
def split_parts(dq):
"""Splits the dual quaternion into its real and dual parts."""
return real_part(dq), dual_part(dq)
def join_parts(real, dual):
"""Creates a dual quaternion from its real and dual parts."""
return jnp.concatenate((real, dual), axi... | Returns the dual number and quaternion conjugate. |
151,372 | from jax import numpy as jnp
from hypernerf import quaternion
def split_parts(dq):
"""Splits the dual quaternion into its real and dual parts."""
return real_part(dq), dual_part(dq)
def join_parts(real, dual):
"""Creates a dual quaternion from its real and dual parts."""
return jnp.concatenate((real, dual), axi... | Normalize a dual quaternion. |
151,373 | from jax import numpy as jnp
from hypernerf import quaternion
def real_part(dq):
"""Returns the real part of the dual quaternion."""
return dq[..., :4]
The provided code snippet includes necessary dependencies for implementing the `get_rotation` function. Write a Python function `def get_rotation(dq)` to solve the... | Returns a rotation quaternion this dual quaternion encodes. |
151,374 | from jax import numpy as jnp
from hypernerf import quaternion
def split_parts(dq):
"""Splits the dual quaternion into its real and dual parts."""
return real_part(dq), dual_part(dq)
def multiply(dq1, dq2):
"""Dual quaternion multiplication.
Args:
dq1: a (*,8) dimensional array representing a dual quaternion... | Returns a translation vector this dual quaternion encodes. |
151,375 | from jax import numpy as jnp
from hypernerf import quaternion
def join_parts(real, dual):
"""Creates a dual quaternion from its real and dual parts."""
return jnp.concatenate((real, dual), axis=-1)
def identity(dtype=jnp.float32):
"""Returns the dual quaternion encoding an identity transform."""
return jnp.arra... | Creates a dual quaternion from a rotation and translation. Args: q: a (*,4) array containing a rotation quaternion. t: a (*,3) array containing a translation vector. Returns: A (*,8) array containing a dual quaternion. |
151,376 | import contextlib
import functools
from matplotlib import cm
from matplotlib import pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
def get_colormap(name, num_bins=256):
"""Lazily initializes and returns a colormap."""
if name == 'turbo':
return _TURBO_COLORS
elif name =... | Colorizes binary logits as a segmentation map. |
151,377 | import contextlib
import functools
from matplotlib import cm
from matplotlib import pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
The provided code snippet includes necessary dependencies for implementing the `plot_to_array` function. Write a Python function `def plot_to_array(... | A context manager that plots to a numpy array. When the context manager exits the output array will be populated with an image of the plot. Usage: ``` with plot_to_array(480, 640, 2, 2) as (fig, axes, out_image): axes[0][0].plot(...) ``` Args: height: the height of the canvas width: the width of the canvas rows: the nu... |
151,378 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
The provided code snippet includes necessary dependencies for implementing the `sample_along_rays` function. Write a Python function `def sample_alo... | Stratified sampling along the rays. Args: key: jnp.ndarray, random generator key. origins: ray origins. directions: ray directions. num_coarse_samples: int. near: float, near clip. far: float, far clip. use_stratified_sampling: use stratified sampling. use_linear_disparity: sampling linearly in disparity rather than de... |
151,379 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
def compute_depth_map(weights, z_vals, depth_threshold=0.5):
"""Compute the depth using the median accumulation.
Note that this differs from the ... | Volumetric Rendering Function. Args: rgb: an array of size (B,S,3) containing the RGB color values. sigma: an array of size (B,S) containing the densities. z_vals: an array of size (B,S) containing the z-coordinate of the samples. dirs: an array of size (B,3) containing the directions of rays. use_white_background: whe... |
151,380 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
def piecewise_constant_pdf(key, bins, weights, num_coarse_samples,
use_stratified_sampling):
"""Piecewise-Constant PDF s... | Hierarchical sampling. Args: key: jnp.ndarray(float32), [2,], random number generator. bins: jnp.ndarray(float32), [batch_size, n_bins + 1]. weights: jnp.ndarray(float32), [batch_size, n_bins]. origins: ray origins. directions: ray directions. z_vals: jnp.ndarray(float32), [batch_size, n_coarse_samples]. num_coarse_sam... |
151,381 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
The provided code snippet includes necessary dependencies for implementing the `noise_regularize` function. Write a Python function `def noise_regul... | Regularize the density prediction by adding gaussian noise. Args: key: jnp.ndarray(float32), [2,], random number generator. raw: jnp.ndarray(float32), [batch_size, num_coarse_samples, 4]. noise_std: float, std dev of noise added to regularize sigma output. use_stratified_sampling: add noise only if use_stratified_sampl... |
151,382 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
The provided code snippet includes necessary dependencies for implementing the `broadcast_feature_to` function. Write a Python function `def broadca... | Matches the shape dimensions (everything except the channel dims). This is useful when you watch to match the shape of two features that have a different number of channels. Args: array: the array to broadcast. shape: the shape to broadcast the tensor to. Returns: The broadcasted tensor. |
151,383 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
The provided code snippet includes necessary dependencies for implementing the `metadata_like` function. Write a Python function `def metadata_like(... | Create a metadata array like a ray batch. |
151,384 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
The provided code snippet includes necessary dependencies for implementing the `vmap_module` function. Write a Python function `def vmap_module(modu... | Vectorize a module. Args: module: the module to vectorize. in_axes: the `in_axes` argument passed to vmap. See `jax.vmap`. out_axes: the `out_axes` argument passed to vmap. See `jax.vmap`. num_batch_dims: the number of batch dimensions (how many times to apply vmap to the module). Returns: A vectorized module. |
151,385 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
def identity_initializer(_, shape):
max_shape = max(shape)
return jnp.eye(max_shape)[:shape[0], :shape[1]] | null |
151,386 | from typing import Optional
from flax import linen as nn
from flax import optim
from flax import struct
from jax import lax
from jax import random
import jax.numpy as jnp
def posenc_window(min_deg, max_deg, alpha):
"""Windows a posenc using a cosiney window.
This is equivalent to taking a truncated Hann window and ... | Encode `x` with sinusoids scaled by 2^[min_deg:max_deg-1]. |
151,387 | from typing import Tuple, Optional
import tensorflow as tf
from tensorflow.experimental import numpy as tnp
def _norm(x):
return tnp.sqrt(tnp.sum(x ** 2, axis=-1, keepdims=True)) | null |
151,388 | from typing import Tuple, Optional
import tensorflow as tf
from tensorflow.experimental import numpy as tnp
def _compute_residual_and_jacobian(
x: tnp.ndarray,
y: tnp.ndarray,
xd: tnp.ndarray,
yd: tnp.ndarray,
k1: float = 0.0,
k2: float = 0.0,
k3: float = 0.0,
p1: float = 0.0,
p2: fl... | Computes undistorted (x, y) from (xd, yd). |
151,389 | import jax
from jax import numpy as jnp
def matmul(a, b):
"""jnp.matmul defaults to bfloat16, but this helper function doesn't."""
return jnp.matmul(a, b, precision=jax.lax.Precision.HIGHEST)
def skew(w: jnp.ndarray) -> jnp.ndarray:
"""Build a skew matrix ("cross product matrix") for vector w.
Modern Robotics E... | Exponential map from Lie algebra so3 to Lie group SO3. Modern Robotics Eqn 3.88. Args: S: (6,) A screw axis of motion. theta: Magnitude of motion. Returns: a_X_b: (4, 4) The homogeneous transformation matrix attained by integrating motion of magnitude theta about S for one second. |
151,390 | import jax
from jax import numpy as jnp
def to_homogenous(v):
return jnp.concatenate([v, jnp.ones_like(v[..., :1])], axis=-1) | null |
151,391 | import jax
from jax import numpy as jnp
def from_homogenous(v):
return v[..., :3] / v[..., -1:] | null |
151,392 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Converts a vision sfm camera into rays. Args: camera: the camera to convert to rays. Returns: A dictionary of rays. Contains: `origins`: the origin of each ray. `directions`: unit vectors representing the direction of each ray. `pixels`: the pixel centers of each ray. |
151,393 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Loads camera and rays defined by the center pixels of a camera. Args: camera_path: a path to an sfm_camera.Camera proto. scale_factor: a factor to scale the camera image by. scene_center: the center of the scene where the camera will be centered to. scene_scale: the scale of the scene by which the camera will also be s... |
151,394 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Convert a input batch from tf Tensors to numpy arrays. |
151,395 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Create a data iterator that returns JAX arrays from a TF dataset. Args: dataset: the dataset to iterate over. batch_size: the batch sizes the iterator should return. repeat: whether the iterator should repeat the dataset. prefetch_size: the number of batches to prefetch to device. devices: the devices to prefetch to. R... |
151,396 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Converts camera params to rays. |
151,397 | import abc
import functools
import itertools
from typing import Any, Optional, Sequence, Union
from absl import logging
from flax import jax_utils
import immutabledict
import jax
import numpy as np
import tensorflow as tf
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import image_utils
... | Broadcasts metadata to the ray shape. |
151,398 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
The provided code snippet includes necessary dependencies for implementing the `load_scene... | Loads the scene center, scale, near and far from scene.json. Args: data_dir: the path to the dataset. Returns: scene_center: the center of the scene (unscaled coordinates). scene_scale: the scale of the scene. near: the near plane of the scene (scaled coordinates). far: the far plane of the scene (scaled coordinates). |
151,399 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
def _load_image(path: types.PathType) -> np.ndarray:
path = gpath.GPath(path)
with pat... | null |
151,400 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
The provided code snippet includes necessary dependencies for implementing the `_load_data... | Loads dataset IDs. |
151,401 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
The provided code snippet includes necessary dependenc... | Loads the scene center, scale, near and far from scene.json. Args: data_dir: the path to the dataset. Returns: scene_center: the center of the scene (unscaled coordinates). scene_scale: the scale of the scene. near: the near plane of the scene (scaled coordinates). far: the far plane of the scene (scaled coordinates). |
151,402 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
def _load_image(path: types.PathType) -> np.ndarray:
... | null |
151,403 | import json
from typing import List, Tuple
from absl import logging
import cv2
import gin
import numpy as np
from hypernerf import camera as cam
from hypernerf import gpath
from hypernerf import types
from hypernerf import utils
from hypernerf.datasets import core
The provided code snippet includes necessary dependenc... | Loads dataset IDs. |
151,404 | import collections
import functools
import os
import time
from typing import Any, Dict, Optional, Sequence
from absl import app
from absl import flags
from absl import logging
from flax import jax_utils
from flax import optim
from flax.metrics import tensorboard
from flax.training import checkpoints
import gin
import j... | Process a dataset iterator and compute metrics. |
151,405 | import collections
import functools
import os
import time
from typing import Any, Dict, Optional, Sequence
from absl import app
from absl import flags
from absl import logging
from flax import jax_utils
from flax import optim
from flax.metrics import tensorboard
from flax.training import checkpoints
import gin
import j... | null |
151,406 | import subprocess
import re
import csv
import os
import time
import shutil
from datetime import datetime
if len(check_wifi_result) == 0:
print("Please connect a WiFi adapter and try again.")
exit()
def check_for_essid(essid, lst):
check_status = True
# If no ESSIDs in list add the row
if len(lst) ... | null |
151,407 | import os
import csv
from PIL import Image
from PIL.ExifTags import GPSTAGS, TAGS
def convert_decimal_degrees(degree, minutes, seconds, direction):
decimal_degrees = degree + minutes / 60 + seconds / 3600
# A value of "S" for South or West will be multiplied by -1
if direction == "S" or direction == "W":
... | null |
151,409 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
print(r"""______ _ _ ______ _ _
| _ \ (_) | | | ___ \ | | | |
| | | |__ ___ ___ __| | | |_/ / ___ _ __ ___ | |__ _... | If the user doesn't run the program with super user privileges, don't allow them to continue. |
151,410 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
wlan_code = re.compile("Interface (wlan[0-9]+)")
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
The provided code snippet includes necessary dependencies for implementing the `find_... | This function is used to find the network interface controllers on your computer. |
151,411 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
wifi_name = network_controllers[int(controller_choice)]
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
The provided code snippet includes necessary dependencies for implementing the... | This function needs the network interface controller name to put it into monitor mode. Argument: Network Controller Name |
151,412 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
wifi_name = network_controllers[int(controller_choice)]
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
The provided code snippet includes necessary dependencies for implementing the... | If you have a 5Ghz network interface controller you can use this function to put monitor either 2.4Ghz or 5Ghz bands or both. |
151,413 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
print(r"""______ _ _ ______ _ _
| _ \ (_) | | | ___ \ | | | |
| | | |__ ___ ___ __| | | |_/ / ___ _ __ ___ | |__ _... | Move all .csv files in the directory to a new backup folder. |
151,414 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
def check_for_essid(essid, lst):
"""Will check if there is an ESSID in the list and then send False to end the loop."""
check_status = True
# If no ESSIDs in list add the row
if len(... | Loop that shows the wireless access points. We use a try except block and we will quit the loop by pressing ctrl-c. |
151,415 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
The provided code snippet includes necessary dependencies for implementing the `set_into_managed_mode` function. Write a Python functi... | SET YOUR NETWORK CONTROLLER INTERFACE INTO MANAGED MODE & RESTART NETWORK MANAGER ARGUMENTS: wifi interface name |
151,416 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
def get_clients(hackbssid, hackchannel, wifi_name):
subprocess.Popen(["airodump-ng", "--bssid", hackbssid, "--channel", hackchanne... | null |
151,417 | import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
subprocess.run(["airmon-ng", "start", wifi_name, hackchannel])
def deauth_attack(network_mac, target_mac, interface):
# We are using aireplay-ng to send a deauth packet. 0 means it will send it... | null |
151,418 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
os.chdir(cwd)
The provided code snippet includes necessary dependencies for implementing the `in_sudo_mode` function. Write a Python function `def in_sudo_mode()` to solve the following probl... | If the user doesn't run the program with super user privileges, don't allow them to continue. |
151,419 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
The provided code snippet includes necessary dependencies for implementing the `arp_scan` function. Write a Python function `def arp_scan(ip_range)` to solve the following problem:
We use the... | We use the arping method in scapy. It is a better implementation than writing your own arp scan. You'll often see that your own arp scan doesn't pick up mobile devices. You can see the way scapy implemented the function here: https://github.com/secdev/scapy/blob/master/scapy/layers/l2.py#L726-L749 Arguments: ip_range -... |
151,420 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
The provided code snippet includes necessary dependencies for implementing the `is_gateway` function. Write a Python function `def is_gateway(gateway_ip)` to solve the following problem:
We c... | We can see the gateway by running the route -n command Argument: The gateway_ip address which the program finds automatically should be supplied as an argument. |
151,421 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
The provided code snippet includes necessary dependencies for implementing the `clients` function. Write a Python function `def clients(arp_res, gateway_res)` to solve the following problem:
... | This function returns a list with only the clients. The gateway is removed from the list. Generally you did get the ARP response from the gateway at the 0 index but I did find that sometimes this may not be the case. Arguments: arp_res (The response from the ARP scan), gateway_res (The response from the gatway_info fun... |
151,422 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
The provided code snippet includes necessary dependencies for implementing the `allow_ip_forwarding` function. Write a Python function `def allow_ip_forwarding()` to solve the following probl... | Run this function to allow ip forwarding. The packets will flow through your machine, and you'll be able to capture them. Otherwise user will lose connection. |
151,423 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
def gateway_info(network_info):
"""We can see the gateway by running the route -n command. This get us the gateway information. We also need the name of the interface for the sniffer funct... | null |
151,424 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
def process_sniffed_pkt(pkt):
""" This function is a callback function that works with the packet sniffer. It receives every packet that goes through scapy.sniff(on_specified_interface) an... | This function will be a packet sniffer to capture all the packets sent to the computer whilst this computer is the MITM. |
151,425 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
choice = print_arp_res(client_info)
The provided code snippet includes necessary dependencies for implementing the `print_arp_res` function. Write a Python function `def print_arp_res(arp_res... | This function creates a menu where you can pick the device whose arp cache you want to poison. |
151,426 | import scapy.all as scapy
import subprocess
import sys
import time
import os
from ipaddress import IPv4Network
import threading
ip_range = get_cmd_arguments()
if ip_range == None:
print("No valid ip range specified. Exiting!")
exit()
if len(arp_res) == 0:
print("No connection. Exiting, make sure devices are... | This function validates the command line arguments supplied on program start-up |
151,427 | import subprocess
import re
import csv
import os
import time
import shutil
from datetime import datetime
if len(check_wifi_result) == 0:
print("Please connect a WiFi controller and try again.")
exit()
def check_for_essid(essid, lst):
check_status = True
# If no ESSIDs in list add the row
if len(ls... | null |
151,428 | import os
import sys
from PIL import Image
from PIL.ExifTags import GPSTAGS, TAGS
def convert_decimal_degrees(degree, minutes, seconds, direction):
decimal_degrees = degree + minutes / 60 + seconds / 3600
# A value of "S" for South or West will be multiplied by -1
if direction == "S" or direction == "W":
... | null |
151,429 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,430 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,431 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,432 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,433 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,434 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,435 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,436 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,437 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | Return running totals |
151,438 | import json
import logging
import math
import re
import string
from abc import abstractmethod
from typing import Any, Dict, Iterable, Iterator, List, MutableMapping, Optional, Sequence, TypeVar, Union
from urllib.parse import urlparse
import operator
import threading
from datetime import datetime
from uuid import UUID
... | null |
151,439 | import os
from numbers import Number
import logging
from collections import defaultdict
from typing import Any, Collection, Dict, Iterator, List, Sequence, Set, Tuple
import attrs
from typing_extensions import Literal
from data_diff.abcs.database_types import ColType_UUID, NumericType, PrecisionType, StringType, Boolea... | null |
151,440 | from argparse import Namespace
from collections import defaultdict
import json
from pathlib import Path
from typing import Any, List, Dict, Tuple, Set, Optional
import attrs
import yaml
from pydantic import BaseModel
from packaging.version import parse as parse_version
from dbt.config.renderer import ProfileRenderer
fr... | null |
151,441 | from argparse import Namespace
from collections import defaultdict
import json
from pathlib import Path
from typing import Any, List, Dict, Tuple, Set, Optional
import attrs
import yaml
from pydantic import BaseModel
from packaging.version import parse as parse_version
from dbt.config.renderer import ProfileRenderer
fr... | null |
151,442 | from argparse import Namespace
from collections import defaultdict
import json
from pathlib import Path
from typing import Any, List, Dict, Tuple, Set, Optional
import attrs
import yaml
from pydantic import BaseModel
from packaging.version import parse as parse_version
from dbt.config.renderer import ProfileRenderer
fr... | null |
151,443 | from argparse import Namespace
from collections import defaultdict
import json
from pathlib import Path
from typing import Any, List, Dict, Tuple, Set, Optional
import attrs
import yaml
from pydantic import BaseModel
from packaging.version import parse as parse_version
from dbt.config.renderer import ProfileRenderer
fr... | null |
151,444 | from argparse import Namespace
from collections import defaultdict
import json
from pathlib import Path
from typing import Any, List, Dict, Tuple, Set, Optional
import attrs
import yaml
from pydantic import BaseModel
from packaging.version import parse as parse_version
from dbt.config.renderer import ProfileRenderer
fr... | null |
151,445 | import base64
from typing import Any, ClassVar, Union, List, Type, Optional
import logging
import attrs
from data_diff.abcs.database_types import (
Timestamp,
TimestampTZ,
Decimal,
Float,
Text,
FractionalType,
TemporalType,
DbPath,
Boolean,
Date,
Time,
)
from data_diff.databa... | null |
151,446 | from typing import Any, ClassVar, Dict, Optional, Type
import attrs
from data_diff.databases.base import (
CHECKSUM_HEXDIGITS,
CHECKSUM_OFFSET,
QueryError,
ThreadedDatabase,
import_helper,
ConnectError,
BaseDialect,
)
from data_diff.abcs.database_types import (
JSON,
NumericType,
... | null |
151,447 | from typing import Any, ClassVar, Type
import attrs
from data_diff.abcs.database_types import TemporalType, ColType_UUID
from data_diff.databases import presto
from data_diff.databases.base import import_helper
from data_diff.databases.base import TIMESTAMP_PRECISION_POS, BaseDialect
def import_trino():
import tri... | null |
151,448 | from functools import partial
import re
from typing import Any, ClassVar, Type
import attrs
from data_diff.schema import RawColumnInfo
from data_diff.utils import match_regexps
from data_diff.abcs.database_types import (
Timestamp,
TimestampTZ,
Integer,
Float,
Text,
FractionalType,
DbPath,
... | null |
151,449 | from functools import partial
import re
from typing import Any, ClassVar, Type
import attrs
from data_diff.schema import RawColumnInfo
from data_diff.utils import match_regexps
from data_diff.abcs.database_types import (
Timestamp,
TimestampTZ,
Integer,
Float,
Text,
FractionalType,
DbPath,
... | null |
151,450 | from typing import Any, ClassVar, Dict, List, Type
import attrs
from data_diff.schema import RawColumnInfo
from data_diff.utils import match_regexps
from data_diff.databases.base import (
CHECKSUM_HEXDIGITS,
CHECKSUM_OFFSET,
MD5_HEXDIGITS,
TIMESTAMP_PRECISION_POS,
BaseDialect,
ConnectError,
... | null |
151,451 | from typing import Any, ClassVar, Dict, Type, Union
import attrs
from data_diff.abcs.database_types import (
Datetime,
Timestamp,
Float,
Decimal,
Integer,
Text,
TemporalType,
FractionalType,
ColType_UUID,
Boolean,
Date,
)
from data_diff.databases.base import (
ThreadedDat... | null |
151,452 | from typing import Any, ClassVar, Dict, Optional, Type
import attrs
from data_diff.databases.base import (
MD5_HEXDIGITS,
CHECKSUM_HEXDIGITS,
TIMESTAMP_PRECISION_POS,
CHECKSUM_OFFSET,
BaseDialect,
ThreadedDatabase,
import_helper,
ConnectError,
)
from data_diff.abcs.database_types import ... | null |
151,453 | import math
from typing import Any, ClassVar, Dict, Sequence, Type
import logging
import attrs
from data_diff.abcs.database_types import (
Date,
Integer,
Float,
Decimal,
Timestamp,
Text,
TemporalType,
NumericType,
DbPath,
ColType,
UnknownColType,
Boolean,
)
from data_diff... | null |
151,454 | from typing import Any, ClassVar, Dict, List, Optional, Type
import attrs
from data_diff.schema import RawColumnInfo
from data_diff.utils import match_regexps
from data_diff.abcs.database_types import (
Decimal,
Float,
Text,
DbPath,
TemporalType,
ColType,
DbTime,
ColType_UUID,
Timest... | null |
151,455 | import abc
import functools
import random
from datetime import datetime
import math
import sys
import logging
from typing import (
Any,
Callable,
ClassVar,
Dict,
Generator,
Iterator,
NewType,
Tuple,
Optional,
Sequence,
Type,
List,
Union,
TypeVar,
)
from functools ... | null |
151,456 | import abc
import functools
import random
from datetime import datetime
import math
import sys
import logging
from typing import (
Any,
Callable,
ClassVar,
Dict,
Generator,
Iterator,
NewType,
Tuple,
Optional,
Sequence,
Type,
List,
Union,
TypeVar,
)
from functools ... | null |
151,457 | import abc
import functools
import random
from datetime import datetime
import math
import sys
import logging
from typing import (
Any,
Callable,
ClassVar,
Dict,
Generator,
Iterator,
NewType,
Tuple,
Optional,
Sequence,
Type,
List,
Union,
TypeVar,
)
from functools ... | null |
151,458 | import abc
import functools
import random
from datetime import datetime
import math
import sys
import logging
from typing import (
Any,
Callable,
ClassVar,
Dict,
Generator,
Iterator,
NewType,
Tuple,
Optional,
Sequence,
Type,
List,
Union,
TypeVar,
)
from functools ... | null |
151,459 | from typing import Any, ClassVar, Dict, Union, Type
import attrs
from packaging.version import parse as parse_version
from data_diff.schema import RawColumnInfo
from data_diff.utils import match_regexps
from data_diff.abcs.database_types import (
Timestamp,
TimestampTZ,
DbPath,
ColType,
Float,
D... | null |
151,460 | import re
from typing import Any, ClassVar, List, Union, Type
import attrs
from data_diff.abcs.database_types import (
ColType,
Array,
JSON,
Struct,
Timestamp,
Datetime,
Integer,
Decimal,
Float,
Text,
DbPath,
FractionalType,
TemporalType,
Boolean,
UnknownColTy... | null |
151,461 | import re
from typing import Any, ClassVar, List, Union, Type
import attrs
from data_diff.abcs.database_types import (
ColType,
Array,
JSON,
Struct,
Timestamp,
Datetime,
Integer,
Decimal,
Float,
Text,
DbPath,
FractionalType,
TemporalType,
Boolean,
UnknownColTy... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.