Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@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 June 3, 2024 01:13
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 June 17, 2023 13:50
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 February 1, 2024 16:06
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 August 27, 2023 13:08

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 January 18, 2024 21:08
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:
@JohannesBuchner
JohannesBuchner / convert_setup_py_to_pyproject_toml.py
Created March 17, 2022 16:42
Convert setup.py to pyproject.toml (WIP)
# Help create a pyproject.toml from a setup.py file
#
# USAGE:
# 1)
# replace "from [a-z.]* import setup" in your setup.py
# with "from convert_setup_py_to_pyproject_toml import setup"
# 2)
# run the resulting script with python, with this script in the PYTHONPATH
#
# The above can be achieved on Linux, for example, with: