Skip to content

Instantly share code, notes, and snippets.

View agentcooper's full-sized avatar

Artem Tyurin agentcooper

View GitHub Profile
/**
* Writing a Mark-Sweep Garbage Collector in C++.
*
* This is a source code for the Lecture 9 from the
* Essentials of Garbage Collectors course:
*
* http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/
*
* See full details in:
*
@agentcooper
agentcooper / save-youtube-subscriptions.md
Last active August 11, 2023 00:56
Save YouTube subscriptions

Open https://www.youtube.com/feed/channels, open JS console.

Save as Markdown list

console.log(
  Array.from(document.querySelectorAll("ytd-channel-renderer"))
    .map((item) => ({
      title: item.querySelector("#text-container").textContent.trim(),
 url: item.querySelector("#main-link").href,
@agentcooper
agentcooper / README.md
Last active September 26, 2020 10:39
Create Roam Research dock icon in macOS
  1. Open Automator.app, click "New Document", select "Application" type.
  2. Create the same workflow as on the screenshot, make sure to use the right URL to your Roam graph.
  3. Save it (⌘S) as Roam.app.
  4. Find the newly created Roam.app in your Applications folder, right click, then "Get Info".
  5. Download and drag roam.icns on the icon in the info window.
  6. Drag Roam.app from Applications to your dock.
<html>
<head>
<title>Run parallel</title>
</head>
<body>
<script>
(async function() {
async function f1() {
return new Promise(res => {
setTimeout(() => {
@agentcooper
agentcooper / subtyping.js
Last active March 22, 2018 07:44
Record and function subtyping examples for TypeScript and Flow
/*
Try this file with both TypeScript [1] and Flow [2].
1. https://www.typescriptlang.org/play/index.html
2. https://flow.org/try/
TypeScript playground also provides a way to run the code -
check where the code is crashing.
@agentcooper
agentcooper / 0.README.md
Last active March 10, 2018 13:49
Sort YouTube playlist/channel by view count or average rating
@agentcooper
agentcooper / 0.README.md
Last active April 9, 2024 19:27
Telegram chat backup/export

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation

@agentcooper
agentcooper / uber-eats.js
Created August 5, 2017 23:31
Uber EATS statistics
/*
Uber EATS statistics
1. Go to https://www.ubereats.com, click **Sign in**
2. Enter your credentials, sign in
3. Open JavaScript console (CMD + Option + J)
4. Copy following code and paste it into the console, hit enter
*/
from PyPDF2.generic import (
DictionaryObject,
NumberObject,
FloatObject,
NameObject,
TextStringObject,
ArrayObject
)
# x1, y1 starts in bottom left corner
@agentcooper
agentcooper / index.js
Last active November 17, 2015 10:48
sicp.js
// node --harmony index.js
var cons = (a, b) => (f) => f(a, b);
var car = (p) => p((p, q) => p);
var cdr = (p) => p((p, q) => q);
var list = (first, ...rest) =>
!first ?