Skip to content

Instantly share code, notes, and snippets.

@LeMoussel
LeMoussel / Chromedriver_Get_Response.py
Last active November 28, 2024 04:12
Python Selenium: Get response attributes via the ChromeDriver performance logging capability
"""
Implementation of the Selenium Chrome WebDriver with HTTP Response data
included via the ChromeDriver performance logging capability
"""
import json
from requests.structures import CaseInsensitiveDict
# https://github.com/SeleniumHQ/selenium
from selenium import webdriver
@3noch
3noch / ListView.py
Last active June 20, 2023 12:01
ListView.py
class ListView():
def __init__(self, items, slice_=None):
start = (slice_.start if slice_ else None) or 0
stop = (slice_.stop if slice_ else None) or float('inf')
step = (slice_.step if slice_ else None) or 1
if isinstance(items, ListView):
self._items = items._items
self._start = max(items._start, items._start + start)
self._stop = min(items._stop, items._start + stop)
self._step = items._step * step
@JohannesDeml
JohannesDeml / README.md
Last active July 17, 2024 14:38
Remove Unity mobile notification warning for WebGL builds

Remove warning

Unity shows the following warning on mobile devices up to Unity 2019.4: "Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway." This script helps you remove this warning

Live example

To see live examples see Unity Web GL Loading Test

Logic

The script will run after the build has completed and replace the checks from all generated javascript files.

Support

@nealfennimore
nealfennimore / wireguard.conf
Last active January 29, 2025 10:57
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@achimnol
achimnol / example.py
Created October 28, 2017 06:45
async getitem with futures
import asyncio
class MyAsyncDict:
async def async_getitem(self, fut, key):
try:
await asyncio.sleep(0.5)
raise RuntimeError('oops')
except Exception as e:
@nazavode
nazavode / ctype_async_raise.py
Last active August 9, 2023 15:48 — forked from liuw/ctype_async_raise.py
Nasty hack to raise exception for other threads
from __future__ import print_function
import ctypes
import threading
import time
def async_raise(thread_obj, exception):
""" Raises an exception inside an arbitrary active :class:`~threading.Thread`.
Parameters
@cobbpg
cobbpg / Unity-hotswapping-notes.md
Last active October 10, 2024 05:55
Unity hotswapping notes

Unity hotswapping notes

Unity has built-in support for hotswapping, which is a huge productivity booster. This feature works not only with graphics assets like bitmaps and meshes, but also with code: if you edit the source and save it, the editor will save the state of the running game, compile and load the new code, then load the saved state and continue where it left off. Unfortunately, this feature is very easy to break, and most available 3rd party plugins have little regard for it.

It looks like there’s a lot of confusion about hotswapping in Unity, and many developers are not even aware of its existence – which is no wonder if their only experience is seeing lots of errors on the console when they forget to stop the game before recompiling... This document is an attempt to clear up some of this confusion.

Nota bene, I’m not a Unity developer, so everything below is based on blog posts and experimentation. Corrections are most welcome!

The basic flow of hotswapping