Skip to content

Instantly share code, notes, and snippets.

@velzie
velzie / manifest-v2-chrome.md
Last active June 8, 2024 19:24
How to keep using adblockers on chrome and chromium

How to keep using adblockers on chrome and chromium

  1. google's manifest v3 has no analouge to the webRequestBlocking API, which is neccesary for (effective) adblockers to work
  2. starting in chrome version 127, the transition to mv3 will start cutting off the use of mv2 extensions alltogether
  3. this will inevitably piss of enterprises when their extensions don't work, so the ExtensionManifestV2Availability key was added and will presumably stay forever after enterprises complain enough

You can use this as a regular user, which will let you keep your mv2 extensions even after they're supposed to stop working

Linux

In a terminal, run:

@voodoohop
voodoohop / chatgpt_image_generation.txt
Last active December 13, 2023 19:45
Allow ChatGPT to generate images using Stable Diffusion
You will now act as a prompt generator.
I will describe an image to you, and you will create a prompt that could be used for image-generation.
Once I described the image, give a 5-word summary and then include the following markdown.
![Image](https://image.pollinations.ai/prompt/{description})
where {description} is:
{sceneDetailed}%20{adjective}%20{charactersDetailed}%20{visualStyle}%20{genre}%20{artistReference}
Make sure the prompts in the URL are encoded. Don't quote the generated markdown or put any code box around it.
@gokart23
gokart23 / run-arm-chroot-on-x86.md
Last active June 3, 2024 00:57
Run ARM chroot on x86 machine (both ArchLinux)

Steps

  1. Install qemu-user-static (yay -S qemu-user-static).
    • This might need you to install pcre-static and update PGP keys (follow the tips in the comments here).
  2. If not already present, install systemd-binfmt, the revamped version of binfmt-support tools
    • Your system has to support transparent Qemu user emulation, but fortunately, that is mostly enabled once the steps here have been followed.
  3. Check the status of the systemd-binfmt unit (systemctl status systemd-binfmt) and (re)start if needed (sudo systemctl restart systemd-binfmt)
    • This unit has ARM support by default, but check the current documentation to make install it if needed
  4. Mount the root partition of the ARM system into a folder (for e.g., sudo mount /dev/sdb2 arm_mountpoint)
  5. Copy the QEMU ARM static binary (/usr/bin/qemu-arm-static on my distro) to the mounted root directory's usr/bin
import sys
from collections import OrderedDict
PY2 = sys.version_info[0] == 2
_internal_attrs = {'_backend', '_parameters', '_buffers', '_backward_hooks', '_forward_hooks', '_forward_pre_hooks', '_modules'}
class Scope(object):
def __init__(self):
self._modules = OrderedDict()
@pklaus
pklaus / rpi3-arch-linux-to-sdcard.sh
Last active February 3, 2023 01:58
Raspberry Pi 3: Arch Linux ARM 64bit to SDcard Script. This is for the Rapsberry Pi 3. For the RPi 2 (or the 3 32bit), see https://gist.github.com/pklaus/9dd4a7bf040788cda501 . For the RPi 1, see https://gist.github.com/pklaus/b92dfc72136d1509c2ed .
#!/bin/bash
# <https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3>
echo -e "\n\nArch Linux ARM to SD Card"
echo -e "For the Raspberry Pi 3, if you want to use the unofficial arm64 variant."
echo -e "(Otherwise use the Raspberry Pi 2 version of this script!)\n\n"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@danijar
danijar / blog_tensorflow_scope_decorator.py
Last active January 17, 2023 01:58
TensorFlow Scope Decorator
# Working example for my blog post at:
# https://danijar.github.io/structuring-your-tensorflow-models
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
"""
A decorator decorator, allowing to use the decorator to be used without
@subfuzion
subfuzion / curl.md
Last active June 6, 2024 17:52
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@thomasfr
thomasfr / autossh.service
Last active May 9, 2024 16:59
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)