Skip to content

Instantly share code, notes, and snippets.

@PiN73
PiN73 / chatgpt-expand-thoughts.js
Last active August 11, 2025 15:25
ChatGPT: button to expand all thoughts [Tampermonkey script]
// ==UserScript==
// @name ChatGPT Expand thoughts
// @version 2025-08-11
// @description useful for expporting chat as html, e.g using SingleFile
// @match https://chatgpt.com/*
// @icon https://chatgpt.com/favicon.ico
// @grant none
// ==/UserScript==
(function () {
@PiN73
PiN73 / yandex-music-spacebar.js
Last active July 30, 2025 15:32
Яндекс Музыка: плей/пауза по клавише пробел [скрипт для Tampermonkey]
// ==UserScript==
// @name Яндекс Музыка ⏵/⏸ [пробел]
// @version 2025-05-13
// @description play/pause yandex music with space key
// @match https://music.yandex.ru/*
// @match https://music.yandex.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=music.yandex.com
// @grant none
// ==/UserScript==
@PiN73
PiN73 / leetcode 716 Max Stack.md
Last active May 13, 2025 23:54
LeetCode 716. Max Stack solution: O(log N) using std::set (no linked lists)

https://leetcode.com/problems/max-stack

https://www.lintcode.com/problem/859

Design a max stack that supports:

  1. push(x): Push element x onto stack.
  2. pop(): Remove the element on top of the stack and return it.
  3. top(): Get the element on the top.
  4. peekMax(): Retrieve the maximum element in the stack.
  5. popMax(): Retrieve the maximum element in the stack, and remove it. If you find more than one maximum elements, only remove the top-most one.
@PiN73
PiN73 / impbcopy.m
Created January 17, 2024 23:02 — forked from kenkeiter/impbcopy.m
Take a selfie, archive it, and copy it to the clipboard -- all from the terminal! (bash + os x)
/////////////////////////////////////////////////////////
// Copied from http://www.alecjacobson.com/weblog/?p=3816
/////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
@PiN73
PiN73 / main.dart
Last active March 17, 2023 23:24
Dart Stream making periodic requests only when has listeners
import 'dart:async';
class MyStream {
late final _controller = StreamController<String>.broadcast(
onListen: _startTimer,
onCancel: _stopTimer,
);
Timer? _timer;
@PiN73
PiN73 / main.dart
Last active February 22, 2022 03:43
Flutter: depend on non-nearest InheritedWidget of given type
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
@PiN73
PiN73 / main.dart
Last active February 22, 2022 03:37
Flutter: find non-nearest ancestor of given type
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
@PiN73
PiN73 / main.dart
Created July 20, 2021 11:48
showDialog in nested Navigator
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Home(),
);
@PiN73
PiN73 / main.dart
Created May 4, 2021 11:55
Flutter transition using Navigator 2.0
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
@PiN73
PiN73 / main.dart
Created May 4, 2021 11:38
Flutter AnimatedSwitcher SlideTransition
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}