Skip to content

Instantly share code, notes, and snippets.

View murtuzaalisurti's full-sized avatar
:octocat:
breaking and fixing code

Murtuzaali Surti murtuzaalisurti

:octocat:
breaking and fixing code
View GitHub Profile
@bobmonsour
bobmonsour / feedsformulti.js
Last active January 19, 2024 07:28
Process an OPML file to generate an array of feeds
// Read from an OPML file and write to a JSON file, processing the OPML file
// and producing the following for each of the feed items in the file:
// name: title of the feed (from the title attribute)
// url: URL of the feed (from the htmlUrl attribute)
// feed: URL of the feed (from the xmlUrl attribute)
// feedtype: type of feed (from the type attribute)
//
// NOTE: This only extracts feeds from the "CSS" and "Eleventy" outlines.
// Remove that test if you wish to extract all of the feeds.
//
@bobmonsour
bobmonsour / getDescription.js
Created April 13, 2023 04:45
An Eleventy filter that extracts the meta description from within the <head> element of a web page
// getDescription - given a url, this Eleventy filter extracts the meta
// description from within the <head> element of a web page using the cheerio
// library.
//
// The full html content of the page is fetched using the eleventy-fetch plugin.
// If you have a lot of links from which you want to extract descriptions, the
// initial build time will be slow. However, the plugin will cache the content
// for a duration of your choosing (in this example, it's set to 1 day).
//
// The description is extracted from the <meta> element with the name attribute
@bramus
bramus / bookmarklet.md
Last active August 3, 2023 16:56
Mastodon User Page Bookmarklet
@tannerdolby
tannerdolby / sort-tags.js
Last active February 10, 2023 19:52
11ty filter for returning a sorted list of tags from collections. Use the it in a template like {{ collections.foo | taglist }} to get the sorted tag list.
eleventyConfig.addFilter("taglist", function(collection) {
const tags = [];
collection.forEach(post => {
tags.push(...post.data.tags);
});
const sorted = [...new Set(tags)].sort((a, b) => a.localeCompare(b));
return sorted;
});
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@danpetitt
danpetitt / nvmuse.md
Last active April 12, 2024 12:23
Using nvmrc on Windows

Using nvmrc on Windows

Unfortunately nvm use on Windows does not change the node version to that specified in the .nvmrc file as its not supported on nvm for Windows: coreybutler/nvm-windows#388

So the easiest solution to this is to use a simple Powershell command that performs an approximation of the command as follows: nvm use $(Get-Content .nvmrc).replace( 'v', '' );

However, thats a bit awkward and we can do a bit more so instead, we can create an 'alias' to a function that calls the command instead:

function callnvm() {
@kauffmanes
kauffmanes / install_anaconda.md
Last active May 6, 2024 02:02
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@renevo
renevo / go-wsl.md
Created September 5, 2018 18:56
Easily update/install Go in wsl

Updating/Installing Go in WSL

Remove

Removes older versions

sudo rm -rf /usr/local/go* && sudo rm -rf /usr/local/go
@stramel
stramel / HOWTO.md
Last active February 28, 2024 17:45
Installing Powerline fonts on Windows 10

Installing Powerline fonts on Windows 10

Steps

  1. Download and extract zip from here
  2. Press Windows + x
  3. Press a (Selects PowerShell (Admin))
  4. Navigate to directory where fonts were extracted to (cd ${HOME}\Downloads\fonts-master\fonts-master)
  5. Set Execution Policy Set-ExecutionPolicy RemoteSigned [1]
  6. Press y then Enter to accept
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 2, 2024 19:03
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem