Skip to content

Instantly share code, notes, and snippets.

@srsudar
srsudar / fzf-find-flags.zsh
Last active January 14, 2021 05:05
Add this to your zshrc to enable `<ctrl-q>` to complete flags using fzf for the entered command. You'll need to already have fzf installed. I've only tested this in zsh on linux. AFAIK `<ctrl-q>` doesn't conflict with any shortcuts I was using, but you should verify that for your own setup. Normally it is a counterpart to `<ctrl-s>`. See https:/…
# See https://github.com/junegunn/fzf/issues/2297 for original discussion.
#
# This generates a list of flags that have previously been used in history
# commands, trying to intelligently parse values for reuse on the prompt. For
# example, with the following history entry files (as shown on zsh):
#
# 1 foo --test --bar=val
# 2 foo -f 123 --bar val
#
# `_find_flags foo` should return:
/**
* Highlight a selection on the page. `sel` is optional and mostly provided
* for testing.
*/
public async highlightCurrentSelection(rangyHighlighter:rangyHl.Highlighter, sel: Selection):
Promise<models.HighlightedText> {
const result: models.HighlightedText =
this.createHighlightedTextFromSelection(rangy);
// It looks like Rangy operates only on WrappedSelection. Faking it doesn't

Keybase proof

I hereby claim:

  • I am srsudar on github.
  • I am samsudar (https://keybase.io/samsudar) on keybase.
  • I have a public key ASBin5VXAMjoYs_9k2B-EOGLhtCZPZ2YGNbzY0kCAgf0PQo

To claim this, I am signing this object:

@srsudar
srsudar / npm publish fails
Created March 23, 2018 05:32
npm publish failing with 401
0 info it worked if it ends with ok
1 verbose cli [ '/Users/sudars/.nvm/versions/node/v9.5.0/bin/node',
1 verbose cli '/Users/sudars/.nvm/versions/node/v9.5.0/bin/npm',
1 verbose cli 'publish',
1 verbose cli '--otp=<redacted>' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session f3147473ceafba14
5 verbose publish [ '.' ]
6 info lifecycle [email protected]~prepublish: [email protected]
# -*- coding: utf-8 -*-
"""
Scale a PNG by an integer factor, keeping it pixelated.
"""
import png
from sys import argv
# We're assuming rgba for for ints per pixel. Looking at the pypng docs there
# are other options this might be, but this is all I needed.
@srsudar
srsudar / background.html
Created July 27, 2014 18:00
Pasting from the system clipboard using a Chrome extension.
<!DOCTYPE html>
<html>
<head>
<script src="background.js"></script>
</head>
<body>
<textarea id="sandbox"></textarea>
</body>