Skip to content

Instantly share code, notes, and snippets.

View Adam--'s full-sized avatar

Adam Anderson Adam--

View GitHub Profile
@Adam--
Adam-- / back key.bat
Created April 8, 2016 14:08
Windows batch files for useful Android ADB commands. Replace [device] with your device as listed from "adb devices" or remove the -s [device] entirely.
adb -s [device] shell input keyevent 4
@Adam--
Adam-- / Integrating Pipenv and Azure Private Package Indexes.md
Last active March 23, 2023 19:12
Integrating Pipenv and Azure Private Package Indexes

Integrating Pipenv and Azure Private Package Indexes

Pipenv is a popular tool for automatically creating and managing Python virtual environments and installing and managing pip packages.

For more information on pipenv, the problems it solves and its benefits checkout the first page of the pipenv docs: Pipenv: Python Dev Workflow for Humans.

Unfortunately, using Azure private package indexes present some technical challenges regarding authentication. Specifically, Azure uses a web based authentication workflow that needs some addition configuration to work with pipenv.

It is assumed that you have a python and pip installed and added to your shell’s path. It's generally recommended to pip install to the user site using --user; however, I found that these user directories are typically not added to the path.

@Adam--
Adam-- / Open-Solution.psd1
Last active January 17, 2023 15:22 — forked from refactorsaurusrex/Open-Solution.psd1
PowerShell function to open the first Visual Studio solution file found within the current directory.
@{
RootModule = 'Open-Solution.psm1'
ModuleVersion = '0.2.0'
GUID = '0d320efd-ae51-49bf-a0b2-3f20ae76d6d0'
Author = 'Original: Nick Spreitzer; Modified: Adam Anderson'
FunctionsToExport = @('Open-Solution', 'Open-AtmelSolution')
AliasesToExport = @('sln', 'atsln')
}
@Adam--
Adam-- / Microsoft.PowerShell_profile.ps1
Last active November 29, 2022 16:25
Loads tools I use in the PowerShell prompt
function RunStep([string] $Description, [ScriptBlock]$script)
{
Write-Host -NoNewline "Loading" $Description.PadRight(20)
& $script
Write-Host "✓" # checkmark emoji
}
RunStep "posh-git" {
# Provides prompt with Git status summary information and tab completion for Git commands, parameters, remotes and branch names.
# https://github.com/dahlbyk/posh-git
{
"version": "1.0",
"components": [
"Component.OpenJDK",
"Component.Android.SDK.MAUI",
"Microsoft.VisualStudio.Component.MonoDebugger",
"Microsoft.VisualStudio.Component.Merq",
"Component.Xamarin.RemotedSimulator",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine",
"Microsoft.VisualStudio.Component.NuGet",
@Adam--
Adam-- / TerminalSetup.md
Last active September 16, 2022 13:39
How to setup an awesome terminal for software development on Windows

Windows Terminal

Windows Terminal is a modern feature-rich open source terminal from Microsoft that runs many shells, including PowerShell. The easiest way to install it is from the Microsoft Store.

Go ahead and open Windows Terminal, which should default to PowerShell. Have a look around, it's already pretty awesome. There's support for multiple tabs, color schemes, custom fonts, custom shells, and more. We are going to customize it even further by setting up git support, customizing the prompt, installing custom fonts, setting the color scheme, and optionally adding a couple of extra tools.

posh-git and oh-my-posh

posh-git allows git information to be displayed within PowerShell and provides tab completion of git commands and branches.

oh-my-posh is a prompt theme engine for PowerShell.

@Adam--
Adam-- / git.config
Last active July 28, 2022 14:27
Git config
[alias]
# Lists all aliases
alias = config --get-regexp ^alias\\.
# Quote a command to allow it to be used as a git alias
quote-string = "!read -r l; printf \\\"!; printf %s \"$l\" | sed 's/\\([\\\"]\\)/\\\\\\1/g'; printf \" #\\\"\\n\" #"
# Gets information about a repo
url = config remote.origin.url
branch-name = rev-parse --abbrev-ref HEAD
@Adam--
Adam-- / PCLStorageCopyExtension.cs
Created September 15, 2016 13:08
Copy a file to a folder using PCLStorage
namespace com.github.gist.adam--
{
using System.Threading;
using PCLStorage;
using FileAccess = PCLStorage.FileAccess;
public static class PCLStorageExtensions
{
public static async void CopyFileTo(this IFile file, IFolder destinationFolder, CancellationToken cancellationToken = default(CancellationToken))
{
@Adam--
Adam-- / choco packages.bat
Last active June 10, 2022 14:33
Installs software I use
REM Installing chocolatey...
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
REM Installing packages...
REM General tools
choco install microsoft-teams -fy
choco install 7zip -fy
choco install paint.net -fy
choco install greenshot -fy
choco install licecap -fy
#r "nuget:Newtonsoft.Json, 13.0.1"
using Newtonsoft.Json;
public class Product
{
public string Name { get; set; }
public DateTime Expiry { get; set; }
public string[] Sizes { get; set; }
}