Skip to content

Instantly share code, notes, and snippets.

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@disco0
disco0 / WSL.md
Created May 28, 2019 04:32 — forked from koca/WSL

WSL Ubuntu Terminal

WSL

Before installing any Linux distros for WSL, you must ensure that the "Windows Subsystem for Linux" optional feature is enabled:

  1. Open PowerShell as Administrator and run:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
@disco0
disco0 / gist:a47d376ea3ffe80b935c47e74c731978
Created June 1, 2019 06:18 — forked from liwh/gist:894109
reload functon for zsh completion
#when we create new function or install new bin , the default zsh cant get the new completion for us,so we
#can add a new function for this problem,you can add the blow content in your .zshrc file
function reload() {
if [[ "$#*" -eq 0 ]]; then
test -r /etc/zsh/zsh-oli && . /etc/zsh/zsh-oli
test -r ~/.zshrc && . ~/.zshrc
return 0
else
local fn
for fn in $*; do
@disco0
disco0 / waitForKeyElements.js
Created August 24, 2019 01:29 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@disco0
disco0 / TwitterLiveFeed.user.js
Last active August 25, 2019 02:59
Force Twitter feed to display latest tweets
// ==UserScript==
// @name TwitterLiveFeed
// @author disk0
// @description Force Twitter feed to display latest tweets
// @version 0.1.1
// @run-at document-idle
// @namespace disk0/twitter
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAEHWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS41LWMwMTEgNzkuMTQ5NTk4LCAyMDEyLzEwLzEwLTEyOjA5OjU2ICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6bnMxPSJodHRwOi8vd3d3LmRheS5jb20vZGFtLzEuMCIKICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICBuczE6UGh5c2ljYWxoZWlnaHRpbmluY2hlcz0iLTEuMCIKICAgbnMxOlBoeXNpY2Fsd2lkdGhpbmluY2hlcz0iLTEuMCIKICAgbnMxOkZpbGVmb3JtYXQ9IlBORyIKICAgbnMxOlByb2dyZ
@disco0
disco0 / VLCxcallbacker.py
Created September 28, 2019 01:21 — forked from dreness/VLCxcallbacker.py
VLCxcallbacker: generate and host a web page of vlc-x-callback links to every video file in a given directory (for #VLC clients on iOS)
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
import socket
from datetime import datetime
from urllib import parse
from klein import Klein
from twisted.web.static import File
from twisted.python.filepath import FilePath
@disco0
disco0 / macmodel.py
Created January 18, 2020 08:49 — forked from mattieb/macmodel.py
A slightly less quick-and-dirty way to look up a Mac's friendly model name.
#!/usr/bin/env python
#
# Looks up a Mac's friendly model name.
#
# Based on http://apple.stackexchange.com/a/98089/21050
#
from subprocess import check_output
from urllib import urlopen
import xml.etree.ElementTree as ET
@disco0
disco0 / stylus.md
Created April 19, 2020 10:55 — forked from tj/stylus.md

Stylus

A dynamic, expressive, powerful language compiling to CSS.

SLIDE:

whoami

tj holowaychuk

@disco0
disco0 / mpv.desktop
Created May 11, 2020 10:38 — forked from zoqaeski/mpv.desktop
MPV single instance controller
[Desktop Entry]
Type=Application
Name=mpv Media Player (Single-instance mode)
GenericName=Multimedia player
Comment=Play movies and songs without starting new instance of multimedia player
Icon=mpv
TryExec=mpvctl
Exec=mpvctl add -- %U
Terminal=false
Categories=AudioVideo;Audio;Video;Player;TV;