Skip to content

Instantly share code, notes, and snippets.

@agentcooper
agentcooper / README.md
Last active Sep 26, 2020
Create Roam Research dock icon in macOS
View README.md
  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.
View run-parallel.html
<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 Mar 22, 2018
Record and function subtyping examples for TypeScript and Flow
View subtyping.js
/*
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 Mar 10, 2018
Sort YouTube playlist/channel by view count or average rating
@agentcooper
agentcooper / 0.README.md
Last active Feb 12, 2021
Telegram chat backup/export
View 0.README.md

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 Aug 5, 2017
Uber EATS statistics
View uber-eats.js
/*
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
*/
View PyPDF2Highlight.py
from PyPDF2.generic import (
DictionaryObject,
NumberObject,
FloatObject,
NameObject,
TextStringObject,
ArrayObject
)
# x1, y1 starts in bottom left corner
View index.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 ?
View crazy.js
var _ = [];
var letters = "abcdefghijklmnopqrstuvwxyz".split('');
letters.forEach(function(letter) {
function f() {
var out = _.join('');
_.length = 0;
return out;
}