Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@rmtbb
rmtbb / ChatGPT Canvas HTML Renderer from Clipboard.url
Last active January 23, 2025 22:45
Bookmarklet that lets you render a full HTML page with any included css and javascript that is currently copied to your clipboard. Also works for SVG code. Useful with ChatGPT Canvas
javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard
@kissgyorgy
kissgyorgy / http_over_ssh_proxy.py
Last active December 24, 2023 16:35
Python: HTTP over SSH
import asyncio
import sys
from typing import Optional
import asyncssh
import httpx
class MySSHTCPSession(asyncssh.SSHTCPSession):
def __init__(self):
//bookmarklet-title: Canvas DL
//bookmarklet-about: When playing skribbl.io and someone has made a nice drawing, this lets you download the current drawing as a PNG.
var w = window.wdq || (window.wdq = document.createElement("a"));
var p = /The word was '([^']*)'/g,
pp = /<span>([^<>]+) is drawing now!/g,
tt = document.body.innerHTML;
var mm, nn, xx;
while (mm = p.exec(tt)) nn = mm;
while (mm = pp.exec(tt)) xx = mm;
@osy
osy / tpm-rant.md
Last active January 13, 2025 06:55
TPM provides zero practical security

TPM provides zero practical security

TPM (Trusted Platform Module) is as useful for preventing real attackers as the TSA is at preventing real terrorists. The architecture is fundamentally flawed and most existing implementations are completely broken. I thought this argument was settled decades ago[1] when "trusted computing" was introduced mostly as a way to provide DRM and ownership capabilities to organizations. It has largely failed to impact the consumer market when it was introduced back in the early 2000s. However, recently there seems to be a movement by certain parties to reintroduce this failed product back to the market. Microsoft argues that in order to use Windows 11, you need TPM 2.0 compatible hardware because[2]:

The Trusted Platform Module(TPM) requirement ena

@Szeraax
Szeraax / docker-compose.yml
Last active February 19, 2025 00:44
Lemmy docker-compose setup
version: '2'
services:
nginx_lemmy:
image: nginx:mainline-alpine
restart: always
ports:
# - <yourReverseProxyTargetPort>:80
- 80:80
depends_on:
@h4n2k
h4n2k / .zshrc
Last active July 27, 2024 14:37
Multiple neovim
# Neovim Switcher
# https://gist.github.com/elijahmanor/b279553c0132bfad7eae23e34ceb593b
#
alias nvim-lazy="NVIM_APPNAME=LazyVim nvim"
alias nvim-kick="NVIM_APPNAME=kickstart nvim"
alias nvim-chad="NVIM_APPNAME=NvChad nvim"
alias nvim-astro="NVIM_APPNAME=AstroNvim nvim"
function nvims() {
items=("default" "kickstart" "LazyVim" "NvChad" "AstroNvim")
@dahlia
dahlia / README.md
Last active October 23, 2022 09:44
Dirty workaround to let VS Code Live Share run on Apple silicon Macs without Rosetta 2

As of June 2022, VS Code's [Live Share] still does not work well on Apple silicon Macs (M1/M2 series) without [Rosetta 2]. Although [this bug is tracked in the official issue tracker on GitHub][1], unfortuneately, Live Share extension is not open source, so no outsiders can send any patch to address this bug to the upstream. Instead, I'd like to share a workaround I found:[^1]

  1. Install [.NET SDK] 6 (arm64) or higher. It's also available on Homebrew Cask: brew install --cask dotnet-sdk.

  2. Replace vsls-agent (no postfix) in

@penk
penk / README.md
Last active October 16, 2024 22:31

How to work with x86_64 binaries in the ARM64 Linux VM on top of M1 macOS Host

Let's take Qt online installer and Qt Creator as an example.

Requirements

At the time of this writing:

// CRACK PARA SUBLIME TEXT 4
// Create for Codigo Cristo
#include <stdio.h>
#include <stdlib.h>
void patch_sublime ();
void patch_merge ();
void msg_end ();
@lazyfrosch
lazyfrosch / config.yaml
Last active December 10, 2024 02:16
Fail2Ban configuration for Grafana's Loki promtail
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /data/positions.yaml
clients:
- url: ${LOKI_HOST}/loki/api/v1/push
basic_auth: