Skip to content

Instantly share code, notes, and snippets.

@MicahElliott
MicahElliott / colortrans.py
Created Nov 29, 2010
Convert values between RGB hex codes and xterm-256 color codes.
View colortrans.py
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@sindresorhus
sindresorhus / git-dirty-checks.md
Created Oct 16, 2012
Benchmark results of the fastest way to check if a git branch is dirty
View git-dirty-checks.md

Tested against the WebKit git repo by entering the repo with 1 file dirty.


git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Oct 21, 2021
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@Dv92
Dv92 / styles.less
Last active Nov 12, 2018
Atom: how to show invisibile characters on selected text like sublime text does
View styles.less
atom-text-editor::shadow {
.editor-contents--private {
.invisible-character {
visibility: hidden;
}
&.has-selection {
.invisible-character {
visibility: visible;
@atcuno
atcuno / gist:3425484ac5cce5298932
Last active Sep 14, 2021
HowTo: Privacy & Security Conscious Browsing
View gist:3425484ac5cce5298932

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@haasn
haasn / about:config.md
Last active Sep 17, 2021
Firefox bullshit removal via about:config
View about:config.md

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@romainl
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active Oct 25, 2021
Vim: pushing built-in features beyond their limits
View Vim_pushing_built-in_features_beyond_their_limits.markdown

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us loose context very quickly,
  • when we need to compare the matches.
@knadh
knadh / zsh-elapsed-time.md
Last active Sep 24, 2021
Elapsed and execution time for commands in ZSH
View zsh-elapsed-time.md

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
  timer=$(($(date +%s%0N)/1000000))