Skip to content

Instantly share code, notes, and snippets.

@sefgit
sefgit / scroll.html
Last active June 27, 2025 10:21
auto scroll
<html>
<head>
<style>
html {
background-color: black;
color:darkgray;
overflow: hidden;
}
#logger {
padding-top:20px;
@sefgit
sefgit / websocket-hook.js
Created June 22, 2025 10:42
websocket hook
//
// https://stackoverflow.com/questions/70205816/intercept-websocket-messages
//
function listen(fn){
fn = fn || console.log;
let property = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
const data = property.get;
@sefgit
sefgit / websocket_proxy.js
Created June 22, 2025 02:35 — forked from Checksum/websocket_proxy.js
Intercepting WebSockets in the browser using JavaScript
const WebSocketProxy = new Proxy(window.WebSocket, {
construct(target, args) {
console.log("Proxying WebSocket connection", ...args);
const ws = new target(...args);
// Configurable hooks
ws.hooks = {
beforeSend: () => null,
beforeReceive: () => null
};
@sefgit
sefgit / api.py
Created May 2, 2025 01:14 — forked from raphaeljolivet/api.py
Add custom rest API to streamlit app
# This code adds custom REST api handler at runtime to a running Streamlit app
#
from tornado.web import Application, RequestHandler
from tornado.routing import Rule, PathMatches
import gc
import streamlit as st
@st.cache_resource()
@sefgit
sefgit / vscodium-extensions.txt
Last active April 26, 2025 13:00
vscodium - extensions
TEMPLATE:
https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${itemName.fieldA}/vsextensions/${itemName.fieldB}/${version}/vspackage
Optionally, add targetPlatform as needed:
?targetPlatform=win32-x64
https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${itemName.fieldA}/vsextensions/${itemName.fieldB}/${version}/vspackage?targetPlatform=win32-x64
https://marketplace.visualstudio.com/items?itemName=Horoko.create-python-project
@sefgit
sefgit / clr_via_native.c
Created April 20, 2025 01:57 — forked from xpn/clr_via_native.c
A quick example showing loading CLR via native code
#include "stdafx.h"
int main()
{
ICLRMetaHost *metaHost = NULL;
IEnumUnknown *runtime = NULL;
ICLRRuntimeInfo *runtimeInfo = NULL;
ICLRRuntimeHost *runtimeHost = NULL;
IUnknown *enumRuntime = NULL;
LPWSTR frameworkName = NULL;
@sefgit
sefgit / server.py
Created April 16, 2025 06:08
Simple python web server
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
import logging
from os import path
from urllib.parse import urlparse
SECURE = False
PORT = 8000
class Handler(SimpleHTTPRequestHandler):
@sefgit
sefgit / index.html
Last active April 14, 2025 02:58
favicon datauri
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" />
<!-- https://davidwalsh.name/blank-favicon -->
#!/usr/bin/python3
'''
Copyright (C) Saeed Gholami Shahbandi. All rights reserved.
Author: Saeed Gholami Shahbandi
This file is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. This program is distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A
@sefgit
sefgit / matplotlib_bottons_x_axis_zoom.py
Created April 13, 2025 14:48 — forked from saeedghsh/matplotlib_bottons_x_axis_zoom.py
A Matplotlib plot with bottons and mouse scroll for y-axis zooming
#!/usr/bin/python3
'''
Copyright (C) Saeed Gholami Shahbandi. All rights reserved.
Author: Saeed Gholami Shahbandi
This file is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. This program is distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without