Skip to content

Instantly share code, notes, and snippets.

recvfrom: type=3, local_port=0
IPv4Socket(0x00440c50): did_receive 112 bytes, total_received=112, packets in queue: 1
IPv4Socket(0x00440c50): recvfrom with blocking 112 bytes, packets in queue: 0
Incoming packet is from: 10.0.2.2:0
ASSERTION FAILED: buffer_length >= ipv4_packet.payload_size()
Net/IPv4Socket.cpp:321 in virtual ssize_t IPv4Socket::recvfrom(FileDescription&, void*, size_t, int, sockaddr*, socklen_t*)
0x0011820f __assertion_failed(char const*, char const*, unsigned int, char const*) +51
0x00137672 IPv4Socket::recvfrom(FileDescription&, void*, unsigned long, int, sockaddr*, unsigned int*) +788
0x00146794 Process::sys$recvfrom(Syscall::SC_recvfrom_params const*) +304
0x0015198e syscall_handler +826
@XavierCooney
XavierCooney / swap_to_transparent.py
Created April 14, 2018 10:08
Swap one colour in an image to transparent with Pillow
import sys
import numpy as np
from PIL import Image
TRANSPARENT_SWAP_COLOUR = (255, 0, 255, 255) # pink
img = Image.open(sys.argv[1]).convert('RGBA')
array = np.array(img)
array[np.where((array == TRANSPARENT_SWAP_COLOUR).all(axis = 2))] = [0, 0, 0, 0]
# Copyright 2018 Xavier Cooney
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR