Skip to content

Instantly share code, notes, and snippets.

View notpushkin's full-sized avatar
🕊️

Alexander Pushkov notpushkin

🕊️
View GitHub Profile
@filips123
filips123 / README.md
Last active October 28, 2024 21:07 — forked from JJRcop/firefoxpwa-runtime-overlayfs.service
Systemd service to use PWAsForFirefox with OverlayFS for runtime

Using PWAsForFirefox with FUSE OverlayFS

This document describes how to use FUSE OverlayFS to link your global Firefox installation with the PWAsForFirefox runtime.

Systemd OS

Prerequisites

  • Your OS uses systemd.
  • Firefox is installed (without Snap or Flatpak).
@comex
comex / assh
Last active July 14, 2023 21:36
#!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
'''Wraps the ssh command, but quotes arguments so that they are passed 1:1 to
the remote command.
'''
import shlex, sys, os
args = sys.argv[1:][::-1]
out = ['ssh']
while args and args[-1].startswith('-'):
arg = args.pop()
@wiseman
wiseman / agent.py
Last active October 18, 2024 10:48
Langchain example: self-debugging
from io import StringIO
import sys
from typing import Dict, Optional
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents.tools import Tool
from langchain.llms import OpenAI
@cemerson
cemerson / archive.org-scanned-book-downloader-bookmarklet.md
Last active November 15, 2024 05:14
Archive.org Scanned Book Downloader Bookmarklet

Archive.org Scanned Book Downloader Bookmarklet

A simple "1-click" javascript approach to downloading a scanned book from archive.org to read at your leisure on the device of your choosing w/out having to manually screenshot every pages of the book by hand. In short it's a glorified "Save Image As..." approach but consolidated down to "1 click". BTW there may be a much better option than this out there - I just built this as an autistic project to see if it would work.

Demo Video

Archive.org SBDL Demo

Obligatory Legal/Disclaimer:

By using this script you agree to delete all book files/images after your 1 hour or 14 days is up! I don't support using this script for any other use cases. After all, none of us have ever kept a library book past it's return date, right?

#!/usr/bin/env bash
# Taken from (and freely modified as no license was specified):
# https://gist.github.com/ecompayment/b1054421eb90f296bbca226683c7ff7e
# https://gist.github.com/pwnsdx/1217727ca57de2dd2a372afdd7a0fc21
# Before running this script, you must:
# - Disable FileVault (if it is enabled) Note: You will not be able to re-enable FileVault AND keep these customisations.
# - Reboot your Mac into Recovery Mode.
# - Select Terminal from top menu and run the following commands:

lenta.com basic promotions API

  • Get your store id at https://lenta.com/api/v1/stores/
  • Grab promoted goods info at:
    https://lenta.com/api/v1/stores/<store_id>/home
    https://lenta.com/api/v1/stores/<store_id>/crazypromotions
    https://lenta.com/api/v1/stores/<store_id>/mobilepromo?hideAlcohol=false&limit=15&offset=0&type=weekly
    
user www-data;
worker_processes auto;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types.conf;
default_type application/octet-stream;
@johnhw
johnhw / umap_sparse.py
Last active November 13, 2024 06:58
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@jtratner
jtratner / generate_typed_dicts.py
Created April 10, 2018 00:32
Example of auto generating type stubs
from datetime import datetime
STRING_DEFAULT = 'string'
DATETIME_DEFAULT = datetime(2015, 1, 1)
INT_DEFAULT = 123
def generate_typed_dicts(name, nested_dict):
full_context = []
final_dict = [f"class {name}(TypedDict):"]
const React = require("react");
const Lifecycles = React.createLifecycleEvents({
didMount({ setState }) {
setState({
disabled: false,
});
},
didUpdate({ inputRef }) {
if (document.activeElement !== inputRef.value) {