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 March 1, 2024 22:25 — 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 March 30, 2024 12:51
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 April 24, 2024 18:53
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 January 6, 2024 16:09
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) {